2025-02-09 02:33:45 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Colors for output
|
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
|
RED='\033[0;31m'
|
|
|
|
|
BLUE='\033[0;34m'
|
|
|
|
|
NC='\033[0m'
|
|
|
|
|
|
|
|
|
|
# Get project directory
|
|
|
|
|
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
|
|
|
|
|
|
# Function to verify a shell script
|
|
|
|
|
verify_script() {
|
2025-02-09 02:54:59 -06:00
|
|
|
local script="$1"
|
2025-02-09 02:33:45 -06:00
|
|
|
echo -e "${BLUE}Checking: ${script}${NC}"
|
|
|
|
|
|
|
|
|
|
# Check if file exists
|
|
|
|
|
if [[ ! -f "$script" ]]; then
|
2025-02-09 02:54:59 -06:00
|
|
|
echo -e "${RED}Error: File not found - $script${NC}"
|
2025-02-09 02:33:45 -06:00
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
|
2025-02-09 02:54:59 -06:00
|
|
|
# Check shell syntax
|
|
|
|
|
if ! bash -n "$script"; then
|
|
|
|
|
echo -e "${RED}Syntax error found in $script${NC}"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check for common shell script issues
|
|
|
|
|
if command -v shellcheck >/dev/null 2>&1; then
|
|
|
|
|
if ! shellcheck "$script"; then
|
|
|
|
|
echo -e "${RED}ShellCheck found issues in $script${NC}"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo -e "${GREEN}Script $script passed verification${NC}"
|
2025-02-09 02:33:45 -06:00
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-09 02:54:59 -06:00
|
|
|
# Main execution
|
|
|
|
|
echo "Starting script verification..."
|
|
|
|
|
|
2025-02-09 02:33:45 -06:00
|
|
|
# Find and verify all shell scripts
|
2025-02-09 02:54:59 -06:00
|
|
|
find "$PROJECT_DIR" -type f -name "*.sh" | while read -r script; do
|
|
|
|
|
verify_script "$script"
|
2025-02-09 02:57:34 -06:00
|
|
|
done
|