|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
| 15 | +default_language_version: |
| 16 | + python: python3 |
| 17 | + |
| 18 | +ci: |
| 19 | + autofix_prs: false |
| 20 | + autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions' |
| 21 | + autoupdate_schedule: quarterly |
| 22 | + |
| 23 | +default_install_hook_types: [pre-commit, commit-msg] |
| 24 | + |
15 | 25 | repos: |
16 | 26 | - repo: https://github.com/pre-commit/pre-commit-hooks |
17 | | - rev: v4.4.0 |
| 27 | + rev: v5.0.0 |
18 | 28 | hooks: |
19 | | - - id: end-of-file-fixer |
20 | | - # only include python files |
21 | | - files: \.py$ |
22 | | - - id: trailing-whitespace |
23 | | - # only include python files |
24 | | - files: \.py$ |
| 29 | + - id: check-added-large-files |
| 30 | + args: ['--maxkb=1000'] |
| 31 | + - id: check-case-conflict |
| 32 | + - id: check-yaml |
| 33 | + - id: detect-private-key |
| 34 | + - id: end-of-file-fixer |
| 35 | + exclude: docs/ |
| 36 | + - id: requirements-txt-fixer |
| 37 | + - id: trailing-whitespace |
25 | 38 |
|
26 | 39 | - repo: https://github.com/astral-sh/ruff-pre-commit |
27 | | - rev: "v0.9.9" # Use the appropriate version |
| 40 | + rev: v0.11.4 |
| 41 | + hooks: |
| 42 | + # Run the linter |
| 43 | + - id: ruff |
| 44 | + args: [--fix] # Enables auto-fixing lint errors |
| 45 | + # Run the formatter |
| 46 | + - id: ruff-format |
| 47 | + |
| 48 | + - repo: local |
28 | 49 | hooks: |
29 | | - - id: ruff |
30 | | - args: ["--fix"] |
31 | | - - id: ruff |
32 | | - args: ["check", "--select", "I", "--fix"] |
33 | | - - id: ruff-format |
| 50 | + - id: check-signoff |
| 51 | + name: Check Signed-off-by |
| 52 | + entry: bash -c 'if ! grep -q "Signed-off-by:" "$1"; then echo "❌ Commit message must be signed off. Use git commit -s to add it automatically."; exit 1; fi' -- |
| 53 | + language: system |
| 54 | + always_run: true |
| 55 | + stages: [commit-msg] |
| 56 | + types: [text] |
34 | 57 |
|
35 | | - # - repo: local |
36 | | - # hooks: |
37 | | - # - id: no-underscore-md |
38 | | - # name: "Disallow '_' in Markdown filenames" |
39 | | - # language: system |
40 | | - # entry: | |
41 | | - # bash -c ' |
42 | | - # # Report the offending files |
43 | | - # echo "[pre-commit] ERROR: Found Markdown files with underscores:" >&2 |
44 | | - # for file in "$@"; do |
45 | | - # echo " - $file (use hyphens instead)" >&2 |
46 | | - # done |
47 | | - # exit 1 |
48 | | - # ' |
49 | | - # files: '.*\/[^\/]*_[^\/]*\.md$' |
50 | | - # exclude: '^\.github/' |
51 | | - # types: [file] |
| 58 | + - id: pre-commit-reminder |
| 59 | + name: Pre-commit Installation Reminder |
| 60 | + entry: echo "⚠️ Remember to install pre-commit and hooks (pip install pre-commit && pre-commit install --install-hooks)" |
| 61 | + language: system |
| 62 | + always_run: true |
| 63 | + pass_filenames: false |
| 64 | + stages: [pre-commit] |
0 commit comments