-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
169 lines (154 loc) · 4.77 KB
/
.pre-commit-config.yaml
File metadata and controls
169 lines (154 loc) · 4.77 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
repos:
# Versioning: Commit messages & changelog
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.13.9
hooks:
- id: commitizen
stages: [commit-msg]
# Lint / autoformat: Python code
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.15.5"
hooks:
# Run the linter
- id: ruff
files: ^src/backend/(?:.*/)*.*$
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter
- id: ruff-format
files: ^src/backend/(?:.*/)*.*$
# Deps: ensure Python uv lockfile is up to date
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.9
hooks:
- id: uv-lock
files: src/backend/pyproject.toml
args: [--project, src/backend]
# Upgrade: upgrade Python syntax
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
# Lint: code cognitive complexity
- repo: https://github.com/rohaquinlop/complexipy-pre-commit
rev: v5.1.0
hooks:
- id: complexipy
# # Dead code: Python usused code detection
# - repo: https://github.com/asottile/dead
# rev: v1.5.2
# hooks:
# - id: dead
# args: ["--exclude", "contrib"]
# Spelling: Checks for common misspellings in text files.
- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
hooks:
- id: codespell
types: [text]
args: [--toml, src/backend/pyproject.toml]
# # Spelling: Checks for common misspellings in text files.
# - repo: https://github.com/crate-ci/typos
# rev: v1.44.0
# hooks:
# - id: typos
# pass_filenames: false
# Autoformat: YAML, JSON, Markdown, etc.
- repo: local
hooks:
- id: oxfmt
name: oxfmt
files: ^
entry: bash -c 'test "$#" -gt 0 && oxfmt --write "$@" || exit 0' --
language: node
"types": [text]
additional_dependencies: ["oxfmt@0.35.0"]
args:
[
"!chart/**",
"!CHANGELOG.md",
"!.all-contributorsrc",
"!renovate.json",
"!src/backend/tests/test_data/**",
"!src/backend/pyproject.toml",
"!src/backend/packages/osm-fieldwork/tests/test_data/**",
"!src/backend/packages/osm-fieldwork/pyproject.toml",
"!src/backend/packages/osm-fieldwork/osm_fieldwork/data_models/**",
"!src/backend/packages/osm-fieldwork/osm_fieldwork/json_data_models/**",
"!src/backend/packages/osm-fieldwork/osm_fieldwork/xlsforms/**",
"!src/backend/packages/area-splitter/pyproject.toml",
]
# # Lint: YAML, JSON, Markdown, etc.
# - repo: https://github.com/oxc-project/mirrors-oxlint
# rev: v1.50.0
# hooks:
# - id: oxlint
# args: [--fix]
# # Lint: Dockerfile (disabled until binary is bundled)
# - repo: https://github.com/hadolint/hadolint.git
# rev: v2.12.1-beta
# hooks:
# - id: hadolint
# args:
# [
# "--ignore=DL3008",
# "--ignore=DL3013",
# "--ignore=DL3018",
# "--ignore=DL3059",
# ]
# Lint & Autoformat: SQL
- repo: https://github.com/sqlfluff/sqlfluff
rev: 4.0.4
hooks:
- id: sqlfluff-lint
files: ^src/migrations/.*\.sql$
types: [sql]
args: ["--dialect", "postgres", "--exclude-rules", "CP05,RF02,RF04"]
- id: sqlfluff-fix
files: ^src/migrations/.*\.sql$
types: [sql]
args: ["--dialect", "postgres", "--exclude-rules", "CP05,RF02,RF04"]
# Lint: Bash scripts
- repo: https://github.com/openstack-dev/bashate.git
rev: 2.1.1
hooks:
- id: bashate
files: ^(?!.*(?:^|/)contrib(?:/|$)).*$
# Lint: Shell scripts
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
files: ^(?!.*(?:^|/)contrib(?:/|$)).*$
args: ["-x", "--exclude=SC2317,SC2188,SC2143,SC2086,SC1091"]
# Lint: GH Workflows
- repo: https://github.com/rhysd/actionlint
rev: v1.7.11
hooks:
- id: actionlint
args: [-ignore, SC]
# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.48.0
hooks:
- id: markdownlint
args:
[
--fix,
--disable,
MD033,
--disable,
MD059,
--ignore,
CHANGELOG.md,
--ignore,
src/backend/packages/osm-fieldwork/LICENSE.md,
--ignore,
src/backend/packages/area-splitter/LICENSE.md,
--ignore,
.github,
--ignore,
src/backend/packages/osm-fieldwork/CHANGELOG.md,
--ignore,
src/backend/packages/area-splitter/CHANGELOG.md,
]