forked from dfinity/ic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
138 lines (127 loc) · 3.99 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: no-commit-to-branch
stages: [commit]
- repo: local
hooks:
# Do not use pygrep, but use a grep shell script.
# Otherwise, on OSX the command line argument limit will be exceeded
# whenever a user runs `pre-commit run -a`
- id: do-not-merge
name: Check for "DO NOT MERGE".
stages: [manual] # Only run this on CI --- it's called DO NOT MERGE, not DO NOT COMMIT.
entry: gitlab-ci/src/checks/do-not-merge.sh
language: system
exclude: |
(?x)^(
.pre-commit-config.yaml|
checks.nix
)$
- id: DFINITY-capitalization
exclude: |
(?x)^(
checks\.nix|
.github/CODEOWNERS|
.pre-commit-config.yaml|
.*/user_map.csv
)$
name: Check for improper capitalization of "DFINITY".
stages: [manual] # Only run this on CI, as it makes no sense to run on commit.
entry: gitlab-ci/src/checks/dfinity-capitalization.sh
language: system
- id: candid_changes_are_backwards_compatible
name: Candid changes are backwards compatible
entry: gitlab-ci/src/checks/candid_changes_are_backwards_compatible.py # TODO: Uncomment (once we figure out how to not cause lots of problems for people): --also-reverse
# Run against all .did files where the path contains nns or registry.
files: (nns|registry|sns).+[.]did$
# Warning: Remember to put the pipe operator at the end of all lines except the last.
exclude: |
(?x)^(
# Is this just test data?
| rs/nns/empty\.did
)$
language: system
always_run: true
- id: bazel_buildifier
name: Auto format bazel build files.
stages: [commit]
entry: bazel run //:buildifier
files: \.bazel|\.bzl$
language: system
# The following repo is maintained by us at
# https://gitlab.com/dfinity-lab/open/pre-commit-tools.
- repo: https://gitlab.com/dfinity-lab/open/pre-commit-tools.git
rev: 78d95356302554075c79ae7b55faf9ef4a1cd94c
hooks:
- id: buf-checks
args: ["--config=buf.yaml"]
exclude: |
(?x)(
)
- id: buf-lint
args: ["--config=buf.yaml"]
- id: shfmt
args: ["-w", "-i", "4", "-bn", "-ci"]
- id: nixpkgs-fmt
exclude: |
(?x)^(
.*/Cargo\.nix|
experimental/.*
)$
- id: rustfmt
exclude: |
(?x)(
experimental/|
rust_canisters/|
nix/overlays/|
gitlab-ci/|
crypto/internal/crypto_lib/fs_ni_dkg/miracl_core
) # exclude these directories.
- id: ormolu
- repo: https://github.com/ambv/black
rev: 20.8b1
hooks:
- id: black
additional_dependencies: ['click==8.0.4']
args:
- --line-length=120
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.4.0
hooks:
- id: reorder-python-imports
args:
- --application-directories=.:gitlab-ci/src/
- repo: https://github.com/pycqa/flake8
rev: '3.8.4'
hooks:
- id: flake8
args: ["--config=gitlab-ci/src/setup.cfg"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.961'
hooks:
- id: mypy
entry: "gitlab-ci/tools/run_mypy"
additional_dependencies: ['types-PyYAML==6.0.11', 'types-pytz==2022.2.1.0']
# Print the number of files as a sanity-check
verbose: true
- repo: https://github.com/pycqa/pydocstyle
rev: 5.1.1
hooks:
- id: pydocstyle
args:
- --ignore=D100,D101,D102,D103,D104,D107,D202,D203,D205,D212,D400,D401,D415
# The default for pydocstyle is to match only on files that end in .py,
# even if pre-commit specifies other files. This makes it so Python
# files will be recognized regardless of extension.
- --match=.*
- repo: https://github.com/willthames/ansible-lint.git
rev: v4.2.0
hooks:
- id: ansible-lint
files: (^|/)testnet/.+\.(yaml|yml)$
exclude: |
(?x)^(
testnet/tests/.*|.*/docker-compose.yml|testnet/env/shared-config\.yml
)$