@@ -4,58 +4,149 @@ repos:
44 rev : v5.0.0
55 hooks :
66 - id : check-merge-conflict
7+ name : " 🌳 git · Detect conflict markers"
78 - id : check-yaml
9+ name : " 📄 format · Validate YAML syntax"
810 - id : check-json
11+ name : " 📄 format · Validate JSON syntax"
12+ - id : check-toml
13+ name : " 📄 format · Validate TOML syntax"
14+ - id : check-added-large-files
15+ name : " 🌳 git · Block large file commits"
16+ args : ['--maxkb=1000']
17+ - id : check-case-conflict
18+ name : " 📁 filesystem · Check case sensitivity"
19+ - id : check-illegal-windows-names
20+ name : " 📁 filesystem · Validate Windows filenames"
21+ - id : check-executables-have-shebangs
22+ name : " 📁 filesystem · Verify shebang presence"
23+ - id : check-shebang-scripts-are-executable
24+ name : " 📁 filesystem · Verify script permissions"
25+ - id : check-symlinks
26+ name : " 📁 filesystem · Check symlink validity"
27+ - id : destroyed-symlinks
28+ name : " 📁 filesystem · Detect broken symlinks"
29+ - id : forbid-new-submodules
30+ name : " 🌳 git · Prevent submodule creation"
931 - id : end-of-file-fixer
32+ name : " 📄 format · Fix EOF"
1033 - id : trailing-whitespace
34+ name : " 📄 format · Trim trailing whitespace"
1135 - id : mixed-line-ending
36+ name : " 📄 format · Fix line endings"
1237 args : [--fix=lf]
38+ - id : fix-byte-order-marker
39+ name : " 📄 format · Remove UTF-8 BOM"
40+ - id : pretty-format-json
41+ name : " 📄 format · Auto-format JSON"
42+ args : ['--autofix', '--indent=2', '--no-sort-keys']
1343 - id : detect-private-key
14-
44+ name : " 🔒 security · Detect private keys"
45+ # YAML formatting (consistent indentation and style)
46+ - repo : https://github.com/google/yamlfmt
47+ rev : v0.13.0
48+ hooks :
49+ - id : yamlfmt
50+ name : " 📄 format · Auto-format YAML"
1551 # Custom secret detection (comprehensive API keys, tokens, credentials)
1652 - repo : local
1753 hooks :
1854 - id : detect-secrets
19- name : Detect Secrets (API Keys, Tokens, Credentials)
20- entry : scripts/detect-secrets.sh
55+ name : " 🔒 security · Detect secrets (API keys, tokens, credentials) "
56+ entry : template/ scripts/detect-secrets.sh
2157 language : system
2258 pass_filenames : false
2359 always_run : false
24-
60+ - id : check-commit-message
61+ name : " 🔒 security · Check commit message (no secrets, IPs)"
62+ entry : template/scripts/check-commit-message.sh
63+ language : system
64+ stages : [commit-msg]
2565 # Python: Ruff (lint + autofix) and Ruff formatter
2666 - repo : https://github.com/astral-sh/ruff-pre-commit
2767 rev : v0.8.4
2868 hooks :
2969 - id : ruff
70+ name : " 🐍 python · Lint and autofix with Ruff"
3071 args : [--fix]
3172 - id : ruff-format
32-
73+ name : " 🐍 python · Format with Ruff "
3374 # Bash: ShellCheck
3475 - repo : https://github.com/shellcheck-py/shellcheck-py
3576 rev : v0.10.0.1
3677 hooks :
3778 - id : shellcheck
38-
79+ name : " 🐚 shell · Lint with ShellCheck "
3980 # Bash: shfmt (format shell scripts)
4081 - repo : https://github.com/scop/pre-commit-shfmt
4182 rev : v3.8.0-1
4283 hooks :
4384 - id : shfmt
85+ name : " 🐚 shell · Format with shfmt"
4486 args :
4587 - -w
4688 - -i
4789 - " 2"
4890 - -ci
4991 - -sr
50-
5192 # Markdown: PyMarkdown (Python-based; avoids nodeenv/Node)
5293 - repo : https://github.com/jackdewinter/pymarkdown
5394 rev : v0.9.25
5495 hooks :
5596 - id : pymarkdown
97+ name : " 📝 markdown · Lint with PyMarkdown"
5698 args : ["--config", ".pymarkdown.json", "scan"]
57- exclude : ^\.github/pull_request_template\.md$
58-
59-
99+ exclude : ^(\.github/pull_request_template\.md|.*IMPROVEMENTS.*\.md|.*SUMMARY.*\.md)$
60100default_language_version :
61101 python : python3
102+
103+ # ============================================================================
104+ # OPTIONAL HOOKS (uncomment to enable)
105+ # ============================================================================
106+
107+ # Optional: Prevent direct commits to main/master (forces PR workflow)
108+ # Note: GitHub branch protection rules are preferred for team environments
109+ # Uncomment the section below to enable:
110+ #
111+ # - repo: https://github.com/pre-commit/pre-commit-hooks
112+ # rev: v5.0.0
113+ # hooks:
114+ # - id: no-commit-to-branch
115+ # name: "🌳 git · Protect main branches"
116+ # args: ["--branch", "main", "--branch", "master"]
117+
118+ # Optional: Run fast tests before commit (good for mature projects with tests)
119+ # Requirements: pip install pytest
120+ # Tip: Mark slow tests with @pytest.mark.slow and exclude them with "-m 'not slow'"
121+ # Uncomment the section below to enable:
122+ #
123+ # - repo: local
124+ # hooks:
125+ # - id: pytest-collect
126+ # name: "🧪 test · Validate test formatting"
127+ # entry: pytest tests
128+ # language: system
129+ # types: [python]
130+ # args: ["--collect-only"]
131+ # pass_filenames: false
132+ # always_run: true
133+ # - id: pytest-fast
134+ # name: "🧪 test · Run fast tests (<3s each)"
135+ # entry: pytest tests
136+ # language: system
137+ # types: [python]
138+ # args: ["-m", "not slow", "--maxfail=1", "-x"]
139+ # pass_filenames: false
140+ # always_run: true
141+
142+ # Optional: SQL linting and formatting (only if project uses SQL files)
143+ # Requirements: pip install sqlfluff
144+ # Uncomment the section below to enable:
145+ #
146+ # - repo: https://github.com/sqlfluff/sqlfluff
147+ # rev: 3.3.0
148+ # hooks:
149+ # - id: sqlfluff-fix
150+ # name: "📊 SQL · Auto-fix rule violations"
151+ # - id: sqlfluff-lint
152+ # name: "📊 SQL · Lint SQL code files"
0 commit comments