Initial commit: loc_az_hci (smom-dbis-138 excluded via .gitignore)
Some checks failed
Test / test (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-02-08 09:04:46 -08:00
commit c39465c2bd
386 changed files with 50649 additions and 0 deletions

92
scripts/quality/lint-scripts.sh Executable file
View File

@@ -0,0 +1,92 @@
#!/bin/bash
source ~/.bashrc
# Lint Scripts
# Run shellcheck on all shell scripts
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
SCRIPTS_DIR="$PROJECT_ROOT/scripts"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
check_shellcheck() {
if ! command -v shellcheck &> /dev/null; then
log_error "shellcheck not found"
log_info "Install shellcheck:"
log_info " Ubuntu/Debian: sudo apt-get install shellcheck"
log_info " macOS: brew install shellcheck"
log_info " Or download from: https://github.com/koalaman/shellcheck"
return 1
fi
return 0
}
lint_scripts() {
log_info "Linting all shell scripts..."
local errors=0
local warnings=0
local total=0
while IFS= read -r -d '' file; do
total=$((total + 1))
log_info "Checking: $file"
if shellcheck -x "$file" 2>&1 | tee /tmp/shellcheck_output.$$; then
log_info " ✓ No issues found"
else
local exit_code=${PIPESTATUS[0]}
if [ $exit_code -eq 0 ]; then
log_info " ✓ No issues found"
else
errors=$((errors + 1))
log_error " ✗ Issues found in $file"
fi
fi
done < <(find "$SCRIPTS_DIR" -name "*.sh" -type f -print0)
echo ""
log_info "Linting complete:"
log_info " Total scripts: $total"
log_info " Errors: $errors"
if [ $errors -eq 0 ]; then
log_info "✓ All scripts passed linting"
return 0
else
log_error "$errors script(s) have issues"
return 1
fi
}
main() {
log_info "Script Linting"
echo ""
if ! check_shellcheck; then
exit 1
fi
lint_scripts
}
main "$@"

View File

@@ -0,0 +1,115 @@
#!/bin/bash
source ~/.bashrc
# Validate Scripts
# Validate script syntax and check for common issues
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
SCRIPTS_DIR="$PROJECT_ROOT/scripts"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
validate_syntax() {
log_info "Validating script syntax..."
local errors=0
local total=0
while IFS= read -r -d '' file; do
total=$((total + 1))
# Check bash syntax
if bash -n "$file" 2>&1; then
log_info "$file: Syntax OK"
else
errors=$((errors + 1))
log_error "$file: Syntax error"
fi
done < <(find "$SCRIPTS_DIR" -name "*.sh" -type f -print0)
echo ""
log_info "Syntax validation complete:"
log_info " Total scripts: $total"
log_info " Errors: $errors"
if [ $errors -eq 0 ]; then
log_info "✓ All scripts have valid syntax"
return 0
else
log_error "$errors script(s) have syntax errors"
return 1
fi
}
check_shebangs() {
log_info "Checking shebangs..."
local missing=0
while IFS= read -r -d '' file; do
if ! head -1 "$file" | grep -q "^#!/bin/bash"; then
missing=$((missing + 1))
log_warn " Missing or incorrect shebang: $file"
fi
done < <(find "$SCRIPTS_DIR" -name "*.sh" -type f -print0)
if [ $missing -eq 0 ]; then
log_info "✓ All scripts have correct shebangs"
else
log_warn "$missing script(s) missing or have incorrect shebangs"
fi
}
check_executable() {
log_info "Checking executable permissions..."
local not_executable=0
while IFS= read -r -d '' file; do
if [ ! -x "$file" ]; then
not_executable=$((not_executable + 1))
log_warn " Not executable: $file"
fi
done < <(find "$SCRIPTS_DIR" -name "*.sh" -type f -print0)
if [ $not_executable -eq 0 ]; then
log_info "✓ All scripts are executable"
else
log_warn "$not_executable script(s) are not executable"
log_info "Run: find scripts/ -name '*.sh' -exec chmod +x {} \\;"
fi
}
main() {
log_info "Script Validation"
echo ""
validate_syntax
echo ""
check_shebangs
echo ""
check_executable
echo ""
log_info "Validation complete"
}
main "$@"