|
| 1 | +# Pre-commit configuration for eoAPI Kubernetes charts |
| 2 | +# Fast, essential checks only - heavy validation moved to CI |
| 3 | + |
| 4 | +repos: |
| 5 | + # Basic file formatting and validation |
| 6 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 7 | + rev: v6.0.0 |
| 8 | + hooks: |
| 9 | + - id: trailing-whitespace |
| 10 | + - id: end-of-file-fixer |
| 11 | + - id: check-yaml |
| 12 | + args: ['--allow-multiple-documents'] |
| 13 | + exclude: ^charts/.+/templates/ |
| 14 | + - id: check-added-large-files |
| 15 | + |
| 16 | + # YAML linting |
| 17 | + - repo: https://github.com/adrienverge/yamllint |
| 18 | + rev: v1.37.1 |
| 19 | + hooks: |
| 20 | + - id: yamllint |
| 21 | + files: \.(yaml|yml)$ |
| 22 | + exclude: ^charts/.+/templates/ |
| 23 | + |
| 24 | + # Shell script validation |
| 25 | + - repo: https://github.com/shellcheck-py/shellcheck-py |
| 26 | + rev: v0.11.0.1 |
| 27 | + hooks: |
| 28 | + - id: shellcheck |
| 29 | + args: ['-e', 'SC1091'] |
| 30 | + |
| 31 | + # GitHub Actions linting |
| 32 | + - repo: https://github.com/rhysd/actionlint |
| 33 | + rev: v1.7.7 |
| 34 | + hooks: |
| 35 | + - id: actionlint |
| 36 | + |
| 37 | + # Fast Helm syntax check only |
| 38 | + - repo: local |
| 39 | + hooks: |
| 40 | + - id: helm-lint-syntax |
| 41 | + name: Helm Syntax Check |
| 42 | + entry: > |
| 43 | + bash -c 'for chart in charts/*/; do |
| 44 | + if [ -f "$chart/Chart.yaml" ]; then |
| 45 | + if grep -q "dependencies:" "$chart/Chart.yaml" 2>/dev/null; then |
| 46 | + if [ -d "$chart/charts" ] && [ -n "$(find "$chart/charts" -name "*.tgz" 2>/dev/null)" ]; then |
| 47 | + echo "Linting $chart (dependencies available)..."; |
| 48 | + helm lint "$chart" --strict || exit 1; |
| 49 | + else echo "Skipping $chart (dependencies not built - run make deploy or scripts/helm-setup.sh first)"; |
| 50 | + fi; else echo "Linting $chart (no dependencies)..."; |
| 51 | + helm lint "$chart" --strict || exit 1; fi; fi; done' |
| 52 | + language: system |
| 53 | + files: ^charts/.+\.(yaml|yml)$ |
| 54 | + pass_filenames: false |
| 55 | + |
| 56 | +# Exclude directories |
| 57 | +exclude: | |
| 58 | + (?x)^( |
| 59 | + \.git/.*| |
| 60 | + charts/.+/charts/.*| |
| 61 | + charts/.+/tmpcharts.*/.* |
| 62 | + )$ |
0 commit comments