|
| 1 | +repos: |
| 2 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 3 | + rev: v6.0.0 |
| 4 | + hooks: |
| 5 | + - id: check-yaml |
| 6 | + - id: end-of-file-fixer |
| 7 | + - id: trailing-whitespace |
| 8 | + - id: check-added-large-files |
| 9 | + - id: check-vcs-permalinks |
| 10 | + - id: check-symlinks |
| 11 | + - id: destroyed-symlinks |
| 12 | + - id: detect-private-key |
| 13 | + - id: check-merge-conflict |
| 14 | + |
| 15 | + # ✅ Python code formatter |
| 16 | + - repo: https://github.com/psf/black |
| 17 | + rev: 23.9.1 |
| 18 | + hooks: |
| 19 | + - id: black |
| 20 | + args: [--line-length=88] |
| 21 | + |
| 22 | + # ✅ Import sorter (runs before Black) |
| 23 | + - repo: https://github.com/PyCQA/isort |
| 24 | + rev: 5.12.0 |
| 25 | + hooks: |
| 26 | + - id: isort |
| 27 | + args: ["--profile=black"] |
| 28 | + |
| 29 | + # ✅ Linter (flake8 for code quality) |
| 30 | + - repo: https://github.com/pycqa/flake8 |
| 31 | + rev: 6.1.0 |
| 32 | + hooks: |
| 33 | + - id: flake8 |
| 34 | + args: |
| 35 | + - --max-line-length=88 |
| 36 | + - --extend-ignore=E203,W503 |
| 37 | + additional_dependencies: |
| 38 | + - flake8-bugbear |
| 39 | + - flake8-comprehensions |
| 40 | + - flake8-docstrings |
| 41 | + |
| 42 | + # ✅ Type checking |
| 43 | + - repo: https://github.com/pre-commit/mirrors-mypy |
| 44 | + rev: v1.10.0 |
| 45 | + hooks: |
| 46 | + - id: mypy |
| 47 | + args: ["--ignore-missing-imports", "--strict"] |
| 48 | + |
| 49 | + # ✅ Security scanning (Bandit) |
| 50 | + - repo: https://github.com/PyCQA/bandit |
| 51 | + rev: 1.7.5 |
| 52 | + hooks: |
| 53 | + - id: bandit |
| 54 | + args: ["-ll", "-r", "."] |
| 55 | + |
| 56 | + # ✅ Detect secrets in code |
| 57 | + - repo: https://github.com/gitleaks/gitleaks |
| 58 | + rev: v8.21.0 |
| 59 | + hooks: |
| 60 | + - id: gitleaks |
| 61 | + args: ["detect", "--verbose"] |
| 62 | + |
| 63 | + # ✅ Static code analysis for Python (pylint optional) |
| 64 | + - repo: https://github.com/pycqa/pylint |
| 65 | + rev: v3.2.6 |
| 66 | + hooks: |
| 67 | + - id: pylint |
| 68 | + args: ["--disable=C0114,C0115,C0116"] # disable docstring warnings |
| 69 | + additional_dependencies: |
| 70 | + - pylint-django |
| 71 | + - pylint-flask |
| 72 | + |
| 73 | + # ✅ Spell checking for docs, code comments, configs |
| 74 | + - repo: https://github.com/codespell-project/codespell |
| 75 | + rev: v2.2.5 |
| 76 | + hooks: |
| 77 | + - id: codespell |
| 78 | + files: ^.*\.(py|c|h|md|rst|yml|go|sh|sql|tf|yaml)$ |
| 79 | + args: ["--ignore-words-list", "hist,nd,bu,maks,gir"] |
| 80 | + |
| 81 | + |
0 commit comments