-
Notifications
You must be signed in to change notification settings - Fork 3
/
.pre-commit-hooks.yaml
207 lines (194 loc) · 6.71 KB
/
.pre-commit-hooks.yaml
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
- id: no-merge-commits
name: Don't create merge commits
entry: Prefer rebase workflow to merge commits
language: fail
stages:
- merge-commit
description: >
For projects that use rebase rather than merge workflows, this hook makes it
easy to enforce that policy. See
https://git-scm.com/book/en/v2/Git-Branching-Rebasing for more details.
- id: asdf-install
name: Install correct versions of tools managed by asdf
entry: asdf install
language: system
always_run: true
pass_filenames: false
stages:
- commit
- push
- post-checkout
- post-rewrite
description: >
Install or set versions of asdf-managed tools based on .tool-versions unless
otherwise configured. See
https://asdf-vm.com/manage/configuration.html#tool-versions for more
details.
- id: poetry-check
name: Validate structure of pyproject.toml
entry: poetry check
language: system
files: \.tool-versions|pyproject\.toml
pass_filenames: false
description: >
Check that Poetry dependencies are properly specified. See
https://python-poetry.org/docs/cli/#check for more details.
- id: poetry-lock
name: Lock Poetry dependencies
entry: poetry lock
language: system
files: \.tool-versions|poetry\.lock|pyproject\.toml
pass_filenames: false
description: >
Update poetry.lock to match pyproject.toml without upgrading already locked
dependencies. See https://python-poetry.org/docs/cli/#lock for more
details.
args: [--no-update]
- id: poetry-install
name: Install Poetry dependencies
entry: poetry install
language: system
always_run: true
pass_filenames: false
stages:
- commit
- push
- post-checkout
- post-rewrite
description: >
Install all Poetry dependencies from poetry.lock. Uninstall any dependencies
not found in the lock file. Requires Poetry 1.2+. See
https://python-poetry.org/docs/cli/#install for more details.
args: [--sync]
- id: pre-commit-install
name: Install pre-commit hooks
entry: poetry run pre-commit install
language: system
always_run: true
pass_filenames: false
stages:
- commit
- push
- post-checkout
- post-rewrite
description: >
Install default hook types and environments for all available hooks. Ensure
that updates to pre-commit's Git hook script are applied. See
https://pre-commit.com/#pre-commit-install and
https://pre-commit.com/#top_level-default_install_hook_types for more
details.
args: [--install-hooks]
- id: yarn-install
name: Install Yarn dependencies
entry: yarn install
language: system
always_run: true
pass_filenames: false
stages:
- commit
- push
- post-checkout
- post-rewrite
description: >
Install all Yarn dependencies, and update yarn.lock. See
https://yarnpkg.com/cli/install for more details.
- id: yarn-dedupe
name: Deduplicate Yarn dependencies
entry: yarn dedupe
language: system
files: \.tool-versions|package\.json|yarn(-(\d+\.){2}\d+\.cjs|\.lock)
pass_filenames: false
description: >
Remove all but the highest version of any duplicates. More than one version
of a package may be required in the case of non-overlapping version
specifications. See https://yarnpkg.com/cli/dedupe for more details.
- id: yarn-audit
name: Perform security audit of Yarn dependencies
entry: yarn npm audit
language: system
pass_filenames: false
description: >
Check Yarn dependencies for known vulnerabilities. See
https://yarnpkg.com/cli/npm/audit for more details.
args: [--all, --recursive]
- id: yarn-sdks
name: Generate Yarn SDKs
entry: src/yarn-sdks.sh
language: script
files: \.yarn/sdks/|yarn(-(\d+\.){2}\d+\.cjs|\.lock)
pass_filenames: false
description: >
Generate SDKs and settings for editors specified in
`.yarn/sdks/integrations.yml`. Format VSCode settings with Prettier to
prevent formatting conflicts with MegaLinter. See
https://yarnpkg.com/sdks/cli/default for more details.
- id: yarn-build
name: Build the app
entry: yarn run build
language: system
files: \.tool-versions|package\.json|yarn(-(\d+\.){2}\d+\.cjs|\.lock)|.*\.ts
pass_filenames: false
description: >
Compile TypeScript files to JavaScript. See https://yarnpkg.com/cli/run for
more details.
- id: yarn-test
name: Run Yarn tests
entry: yarn run test
language: system
types:
- ts
require_serial: true
description: >
Run the Jest tests that check the modified files. See
https://yarnpkg.com/cli/run and
https://jestjs.io/docs/cli#--findrelatedtests-spaceseparatedlistofsourcefiles
for more details.
args: [--passWithNoTests, --findRelatedTests]
- id: megalinter-incremental
name: Run MegaLinter (skipping linters that run in project mode)
entry: >
npx -- [email protected]
--container-name megalinter-incremental
--remove-container
--fix
--env LOG_LEVEL=warning
--filesonly
language: system
stages:
- commit
require_serial: true
description: >
See https://megalinter.io/latest/mega-linter-runner/#usage and
https://megalinter.io/latest/configuration/ if you wish to override the
default arguments. mega-linter-runner is specified as an argument so that
you may override the version (e.g., [email protected]). Depends on
npx, which ships with npm 7+, and Docker. Runs very slowly when the
pertinent Docker image isn't already cached (c.f.,
https://github.com/marketplace/actions/docker-cache/). If you encounter
permission errors, try running Docker in rootless mode (c.f.,
https://github.com/marketplace/actions/rootless-docker/). Linter results are
logged to the megalinter-reports directory, so list it in your .gitignore.
Skip linters that run in project mode since they don't run incrementally.
- id: megalinter-full
name: Run MegaLinter
entry: >
npx -- [email protected]
--container-name megalinter-full
--remove-container
--fix
--env LOG_LEVEL=warning
language: system
stages:
- push
require_serial: true
description: >
See https://megalinter.io/latest/mega-linter-runner/#usage and
https://megalinter.io/latest/configuration/ if you wish to override the
default arguments. mega-linter-runner is specified as an argument so that
you may override the version (e.g., [email protected]). Depends on
npx, which ships with npm 7+, and Docker. Runs very slowly when the
pertinent Docker image isn't already cached (c.f.,
https://github.com/marketplace/actions/docker-cache/). If you encounter
permission errors, try running Docker in rootless mode (c.f.,
https://github.com/marketplace/actions/rootless-docker/). Linter results are
logged to the megalinter-reports directory, so list it in your .gitignore.