-
Notifications
You must be signed in to change notification settings - Fork 32
/
.pre-commit-config.yaml
141 lines (141 loc) · 4.51 KB
/
.pre-commit-config.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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
#
# Install pre-commit itself:
# $ pip install pre-commit
# OR
# $ brew install pre-commit
#
# Update all pre-commit hooks to latest version:
# $ pre-commit autoupdate
#
# Install all default pre-commit hooks locally:
# $ pre-commit install
#
# Install commit-msg hooks locally (e.g. for conventional commits):
# $ pre-commit install --hook-types commit-msg
#
# Apply a given pre-commit hook to all files:
# $ pre-commit run --all-files <id>
#
# Apply all pre-commit hooks to all files:
# $ pre-commit run --all-files
default_stages: [pre-push, manual]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-yaml
- id: end-of-file-fixer
exclude: |
(?x)^(
.browser|
.nvmrc
)$
- id: name-tests-test
args: [--pytest-test-first]
exclude: tests/tools/.*
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.2.0
hooks:
# Most common ones: [build, chore, ci, docs, feat, fix, refactor, test]
# https://conventionalcommits.org
- id: conventional-pre-commit
stages: [commit-msg]
- repo: https://github.com/PyCQA/flake8.git
rev: 7.1.0
hooks:
- id: flake8
- repo: https://github.com/google/yapf
# Use v0.31.0 to match the version in Chromium depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools.git
# XXX: Upgrade to v0.32.0 when upstream is addressed: https://bugs.chromium.org/p/chromium/issues/detail?id=1420681
# Otherwise formatting is inconsistent, e.g. https://github.com/GoogleChromeLabs/chromium-bidi/issues/889
rev: v0.31.0
hooks:
- id: yapf
args: [--in-place, --parallel]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
hooks:
- id: mypy
additional_dependencies: [types-requests]
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py310-plus]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.9
hooks:
- id: bandit
args: [--ini, .bandit]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
# skip false positives
args:
[
--skip=package-lock.json,
--skip=tests/screenshot/test_screenshot.py,
--skip=*.py.ini,
-L=thirdParty,
]
exclude_types: [pem]
- repo: https://github.com/google/keep-sorted
rev: v0.4.0
hooks:
- id: keep-sorted
- repo: local
hooks:
- id: copyright
name: check copyright
entry: |-
.* Copyright [0-9]+ Google LLC.
.* Copyright \(c\) Microsoft Corporation.
.*
.* Licensed under the Apache License, Version 2.0 \(the "License"\);
.* you may not use this file except in compliance with the License.
.* You may obtain a copy of the License at
.*
.* http://www.apache.org/licenses/LICENSE-2.0
.*
.* Unless required by applicable law or agreed to in writing, software
.* distributed under the License is distributed on an "AS IS" BASIS,
.* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
.* See the License for the specific language governing permissions and
.* limitations under the License.
language: pygrep
types_or: [javascript, ts, python]
exclude: __init__\.py$
args: [--negate, --multiline]
- id: node-self
name: check nodejs `self.`
entry: '\bself\.'
language: pygrep
types_or: [ts]
# ESLint is the slowest hook, so keep it at the bottom.
- id: eslint
name: eslint
entry: 'npm run format:eslint'
language: system
verbose: true
pass_filenames: false
# ESLint may update code style (formatting) so keep prettier last.
- id: prettier
name: prettier
entry: 'npm run format:prettier'
language: system
pass_filenames: false