|
| 1 | +repos: |
| 2 | + # ✅ Precommit hooks |
| 3 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 4 | + rev: v4.4.0 |
| 5 | + hooks: |
| 6 | + - id: check-yaml |
| 7 | + - id: end-of-file-fixer |
| 8 | + - id: trailing-whitespace |
| 9 | + - id: check-added-large-files |
| 10 | + - id: check-vcs-permalinks |
| 11 | + - id: check-symlinks |
| 12 | + - id: destroyed-symlinks |
| 13 | + - id: pretty-format-json |
| 14 | + |
| 15 | + # ✅ golang fmt and go tidey |
| 16 | + - repo: https://github.com/TekWizely/pre-commit-golang |
| 17 | + rev: v1.0.0-rc.1 |
| 18 | + hooks: |
| 19 | + - id: go-fmt |
| 20 | + args: [-w] |
| 21 | + - id: go-mod-tidy # Ensure go.mod & go.sum are tidy |
| 22 | + |
| 23 | + - repo: https://github.com/psf/black |
| 24 | + rev: 23.9.1 |
| 25 | + hooks: |
| 26 | + - id: black |
| 27 | + args: [--line-length=88] |
| 28 | + # ✅ Import sorter (runs before Black) |
| 29 | + - repo: https://github.com/PyCQA/isort |
| 30 | + rev: 5.12.0 |
| 31 | + hooks: |
| 32 | + - id: isort |
| 33 | + args: ["--profile=black"] |
| 34 | + |
| 35 | + # ✅ Linter (flake8 for code quality) |
| 36 | + - repo: https://github.com/pycqa/flake8 |
| 37 | + rev: 6.1.0 |
| 38 | + hooks: |
| 39 | + - id: flake8 |
| 40 | + args: |
| 41 | + - --max-line-length=88 |
| 42 | + - --extend-ignore=E203,W503 |
| 43 | + additional_dependencies: |
| 44 | + - flake8-bugbear |
| 45 | + - flake8-comprehensions |
| 46 | + - flake8-docstrings |
| 47 | + # ✅ Static code analysis for Python (pylint optional) |
| 48 | + - repo: https://github.com/pycqa/pylint |
| 49 | + rev: v3.2.6 |
| 50 | + hooks: |
| 51 | + - id: pylint |
| 52 | + args: ["--disable=C0114,C0115,C0116"] |
| 53 | + additional_dependencies: |
| 54 | + - pylint-django |
| 55 | + - pylint-flask |
| 56 | + # ✅ Terraform docs |
| 57 | + - repo: https://github.com/terraform-docs/terraform-docs |
| 58 | + rev: "v0.16.0" |
| 59 | + hooks: |
| 60 | + - id: terraform-docs-go |
| 61 | + args: ["markdown", "table", "--output-file", "README.md", "./"] |
| 62 | + |
| 63 | + # ✅ Terraform precommit |
| 64 | + - repo: https://github.com/antonbabenko/pre-commit-terraform |
| 65 | + rev: "v1.74.1" |
| 66 | + hooks: |
| 67 | + - id: terraform_fmt |
| 68 | + - id: terraform_validate |
| 69 | + - id: terraform_tflint |
| 70 | + - id: terraform_tfsec |
| 71 | + |
| 72 | + # ✅ Stylelint |
| 73 | + - repo: https://github.com/thibaudcolas/pre-commit-stylelint |
| 74 | + rev: v15.10.3 |
| 75 | + hooks: |
| 76 | + - id: stylelint |
| 77 | + files: \.(css|scss)$ |
| 78 | + exclude: "node_modules/" |
| 79 | + additional_dependencies: |
| 80 | + - stylelint |
| 81 | + - stylelint-config-standard |
| 82 | + args: ['--config', '.stylelintrc.json', '--fix'] |
| 83 | + |
| 84 | + # ✅ Codespell |
| 85 | + - repo: https://github.com/codespell-project/codespell |
| 86 | + rev: v2.2.5 |
| 87 | + hooks: |
| 88 | + - id: codespell |
| 89 | + files: ^.*\.(py|c|h|md|rst|yml|go|sh|sql|tf|yaml)$ |
| 90 | + args: ["--ignore-words-list", "hist,nd"] |
| 91 | + # ✅ Gitleaks |
| 92 | + - repo: https://github.com/gitleaks/gitleaks |
| 93 | + rev: v8.21.0 |
| 94 | + hooks: |
| 95 | + - id: gitleaks |
| 96 | + args: ["detect", "--verbose"] |
| 97 | + verbose: true |
0 commit comments