Completed clean root directory structure: - Root now contains only: .git, .env, docs/, orig/ - Moved all remaining files and directories to orig/: - Config files (.claude, .dockerignore, .drone.yml, etc.) - All .env variants (except active .env) - Git config (.gitconfig, .github, .gitignore, etc.) - Tool configs (.golangci.yml, .revive.toml, etc.) - Documentation (*.md files, @prompts) - Build files (Dockerfiles, Makefile, go.mod, go.sum) - Docker compose files - All source directories (scripts, tests, tools, etc.) - Runtime directories (logs, monitoring, reports) - Dependency files (node_modules, lib, cache) - Special files (--delete) - Removed empty runtime directories (bin/, data/) V2 structure is now clean: - docs/planning/ - V2 planning documents - orig/ - Complete V1 codebase preserved - .env - Active environment config (not in git) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
156 lines
3.7 KiB
Bash
Executable File
156 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This script runs comprehensive code quality checks
|
|
|
|
set -e
|
|
|
|
echo "Starting comprehensive code quality checks..."
|
|
|
|
# Initialize exit code
|
|
exit_code=0
|
|
|
|
# Run gofmt to check formatting
|
|
echo "Running gofmt check..."
|
|
unformatted=$(go fmt ./...)
|
|
if [ -n "$unformatted" ]; then
|
|
echo "❌ Some files need formatting:"
|
|
echo "$unformatted"
|
|
exit_code=1
|
|
else
|
|
echo "✅ All files are properly formatted"
|
|
fi
|
|
|
|
# Run go vet
|
|
echo "Running go vet..."
|
|
if ! go vet ./...; then
|
|
echo "❌ go vet failed"
|
|
exit_code=1
|
|
else
|
|
echo "✅ go vet passed"
|
|
fi
|
|
|
|
# Run errcheck
|
|
echo "Running errcheck..."
|
|
if command -v errcheck >/dev/null 2>&1; then
|
|
if ! errcheck -blank ./...; then
|
|
echo "❌ errcheck found unchecked errors"
|
|
exit_code=1
|
|
else
|
|
echo "✅ errcheck passed"
|
|
else
|
|
echo "⚠️ errcheck not installed, skipping"
|
|
fi
|
|
|
|
# Run ineffassign
|
|
echo "Running ineffassign..."
|
|
if command -v ineffassign >/dev/null 2>&1; then
|
|
if ! ineffassign ./...; then
|
|
echo "❌ ineffassign found ineffective assignments"
|
|
exit_code=1
|
|
else
|
|
echo "✅ ineffassign passed"
|
|
else
|
|
echo "⚠️ ineffassign not installed, skipping"
|
|
fi
|
|
|
|
# Run staticcheck
|
|
echo "Running staticcheck..."
|
|
if command -v staticcheck >/dev/null 2>&1; then
|
|
if ! staticcheck ./...; then
|
|
echo "❌ staticcheck found issues"
|
|
exit_code=1
|
|
else
|
|
echo "✅ staticcheck passed"
|
|
else
|
|
echo "⚠️ staticcheck not installed, skipping"
|
|
fi
|
|
|
|
# Run structcheck
|
|
echo "Running structcheck..."
|
|
if command -v structcheck >/dev/null 2>&1; then
|
|
if ! structcheck ./...; then
|
|
echo "❌ structcheck found unused struct fields"
|
|
exit_code=1
|
|
else
|
|
echo "✅ structcheck passed"
|
|
else
|
|
echo "⚠️ structcheck not installed, skipping"
|
|
fi
|
|
|
|
# Run varcheck
|
|
echo "Running varcheck..."
|
|
if command -v varcheck >/dev/null 2>&1; then
|
|
if ! varcheck ./...; then
|
|
echo "❌ varcheck found unused variables"
|
|
exit_code=1
|
|
else
|
|
echo "✅ varcheck passed"
|
|
else
|
|
echo "⚠️ varcheck not installed, skipping"
|
|
fi
|
|
|
|
# Run deadcode
|
|
echo "Running deadcode..."
|
|
if command -v deadcode >/dev/null 2>&1; then
|
|
if ! deadcode ./...; then
|
|
echo "❌ deadcode found unused code"
|
|
exit_code=1
|
|
else
|
|
echo "✅ deadcode passed"
|
|
else
|
|
echo "⚠️ deadcode not installed, skipping"
|
|
fi
|
|
|
|
# Run gocyclo
|
|
echo "Running gocyclo for cyclomatic complexity..."
|
|
if command -v gocyclo >/dev/null 2>&1; then
|
|
if gocyclo -over 15 ./...; then
|
|
echo "⚠️ Found functions with high cyclomatic complexity (over 15)"
|
|
else
|
|
echo "✅ All functions have reasonable cyclomatic complexity"
|
|
else
|
|
echo "⚠️ gocyclo not installed, skipping"
|
|
fi
|
|
|
|
# Run goconst
|
|
echo "Running goconst for repeated strings..."
|
|
if command -v goconst >/dev/null 2>&1; then
|
|
if ! goconst -min-occurrences 3 ./...; then
|
|
echo "⚠️ Found repeated strings that could be constants"
|
|
else
|
|
echo "✅ goconst found no issues"
|
|
else
|
|
echo "⚠️ goconst not installed, skipping"
|
|
fi
|
|
|
|
# Run dupl
|
|
echo "Running dupl for code duplication..."
|
|
if command -v dupl >/dev/null 2>&1; then
|
|
if dupl -threshold 100 ./...; then
|
|
echo "⚠️ Found duplicated code blocks"
|
|
else
|
|
echo "✅ No significant code duplication found"
|
|
else
|
|
echo "⚠️ dupl not installed, skipping"
|
|
fi
|
|
|
|
# Run nakedret
|
|
echo "Running nakedret for naked returns..."
|
|
if command -v nakedret >/dev/null 2>&1; then
|
|
if nakedret -l 10 ./...; then
|
|
echo "⚠️ Found naked returns in functions with more than 10 lines"
|
|
else
|
|
echo "✅ nakedret found no issues"
|
|
else
|
|
echo "⚠️ nakedret not installed, skipping"
|
|
fi
|
|
|
|
echo "Code quality checks completed."
|
|
|
|
if [ $exit_code -ne 0 ]; then
|
|
echo "❌ Some code quality checks failed"
|
|
exit $exit_code
|
|
else
|
|
echo "✅ All code quality checks passed"
|
|
exit 0
|
|
fi |