.pre-commit-config.yaml 2.14 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
default_install_hook_types:
  - pre-commit
  - commit-msg
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      # list of supported hooks: https://pre-commit.com/hooks.html
      - id: check-yaml
        args: ["--unsafe"]
      - id: debug-statements
      - id: end-of-file-fixer
      - id: mixed-line-ending
        args: ["--fix=lf"]
      - id: trailing-whitespace
        args: ["--markdown-linebreak-ext=md"]

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.10
    hooks:
    - id: ruff-check
      args: [--output-format, github, --fix]
    - id: ruff-format

  - repo: https://github.com/crate-ci/typos
    rev: typos-dict-v0.13.13
    hooks:
      - id: typos
        # only for staged files

  - repo: https://github.com/rhysd/actionlint
    # v1.7.8+ sets `go 1.24.0` in go.mod, which older Go toolchains (and most
    # current CI images) cannot parse. Pin to v1.7.7 until actionlint fixes the
    # go.mod directive.
    rev: v1.7.7
    hooks:
      - id: actionlint
        files: ^\.github/workflows/.*\.ya?ml$


  - repo: local
    hooks:
    - id: signoff-commit
      name: Sign-off Commit
      entry: bash
      args:
        - -c
        - |
          if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then
            printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)"
          fi
      language: system
      verbose: true
      stages: [commit-msg]

    # Keep `suggestion` last
    - id: suggestion
      name: Suggestion
      entry: bash -c 'echo "To bypass all the pre-commit hooks, add --no-verify to git commit. To skip a specific hook, prefix the commit command with SKIP=<hook-id>."'
      language: system
      verbose: true
      pass_filenames: false
    # Insert new entries above the `suggestion` entry

    - id: check-pickle-imports
      name: Prevent new pickle/cloudpickle imports
      entry: python tools/pre_commit/check_pickle_imports.py
      language: python
      types: [python]
      additional_dependencies: [regex]