-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
148 lines (136 loc) · 4.68 KB
/
.pre-commit-config.yaml
File metadata and controls
148 lines (136 loc) · 4.68 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
default_install_hook_types:
- pre-commit
- commit-msg
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
stages: [pre-commit, manual]
# Ignore some Yaml's with following pattern in `testdata` subdirectories.
exclude: testdata/.*?(?:invalid|bad|broken|wrong)[^/]*\.ya?ml$
- id: check-merge-conflict
stages: [pre-commit, manual]
- id: no-commit-to-branch
stages: [pre-commit]
args: [--branch, master, --pattern, release/.*]
- id: file-contents-sorter
name: "Sort cspell dictionary"
stages: [pre-commit, manual]
files: ".cspell_project-words.txt"
args: [--ignore-case, --unique]
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v9.1.0
hooks:
- id: cspell
name: "Spell checking commit message"
stages: [commit-msg]
args: [--config=.cspell.yaml, --show-context, --show-suggestions]
additional_dependencies:
- "@cspell/dict-markdown"
- "@cspell/dict-ru_ru"
- "@cspell/dict-golang"
- "@cspell/dict-python"
- "@cspell/dict-lua"
- "@cspell/dict-cpp"
- "@cspell/dict-software-terms"
- id: cspell
name: "Spell checking source files"
stages: [pre-commit, manual]
args: [--config=.cspell.yaml, --show-context, --show-suggestions]
types_or: [go, python, markdown]
exclude: |
(?x)^(
.*\.pb\.go|
.*/third_party/.*|
.*-gdb\.py
)$
additional_dependencies:
- "@cspell/dict-markdown"
- "@cspell/dict-ru_ru"
- "@cspell/dict-golang"
- "@cspell/dict-python"
- "@cspell/dict-lua"
- "@cspell/dict-cpp"
- "@cspell/dict-software-terms"
- repo: local
hooks:
- id: go-format
language: golang
types: [go]
name: "Go: formatting sources"
stages: [pre-commit, manual]
exclude: \.pb\.go$
entry: bash -c "GOFUMPT_SPLIT_LONG_LINES=on gofumpt $@"
args: [-e, -w, -extra]
additional_dependencies:
- mvdan.cc/gofumpt@v0.8.0
- repo: https://github.com/segmentio/golines
rev: b3563a80300708f80336c70c746bb81b3d0fe73e
hooks:
- id: golines
name: "Go: shorten long lines"
stages: [pre-commit, manual]
exclude: \.pb\.go$
args: [--max-len=100, --tab-len=4, --no-reformat-tags]
- repo: https://github.com/golangci/golangci-lint
rev: v2.9.0
hooks:
- id: golangci-lint
name: "Go: verify sources"
description: |
Checking only `staged` changes, added to be committed.
Issue `golangci-lint` command does not have an option to accept specified list of files.
pass_filenames: false
stages: [pre-commit]
args: [--fast-only, --config=golint-precommit.yml]
- id: golangci-lint-full
name: "Go: verify all sources (CI)"
description: Checking all Go sources.
always_run: true
stages: [manual]
args: [--config=golint-precommit-ci.yml, --allow-parallel-runners]
- repo: local
hooks:
- id: golangci-lint-diff
language: golang
types: [go]
name: "Go: verify sources diff (CI)"
description: Checking only fresh changes, added to the PR.
stages: [manual]
always_run: true
entry: >-
bash -c "golangci-lint run --new-from-rev=${BASE_BRANCH:-master}
--config=golint-precommit.yml --allow-parallel-runners"
additional_dependencies:
- github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
hooks:
- id: ruff-format
name: "Py: Run the formatter"
stages: [pre-commit, manual]
files: test/.*\.py$
- id: ruff-check
name: "Py: Run the linter"
args: [--fix]
stages: [pre-commit, manual]
files: test/.*\.py$
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.18.1
hooks:
- id: markdownlint-cli2
name: "MD: check markdown files"
stages: [pre-commit, manual]
# Ignore Markdown rules for `.github`, due to specific formatting for Pull Requests.
exclude: \.github/.*\.md$
args: [--fix]
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
name: "Verify commit message format"
stages: [commit-msg]
args: [--staged, --config, .gitlint-precommit.ini, --msg-filename]