forked from dfinity/dre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
116 lines (108 loc) · 3.19 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
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: no-commit-to-branch
stages: [commit]
# 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: 65e8990328b0651ab00d5653d26535d4080ca5f3
hooks:
- id: shfmt
args: ["-w", "-i", "4", "-bn", "-ci"]
- id: nixpkgs-fmt
exclude: |
(?x)^(
.*/Cargo\.nix|
experimental/.*
)$
- id: rustfmt
- id: ormolu
- repo: https://github.com/ambv/black
rev: 24.3.0
hooks:
- id: black
additional_dependencies: ["click==8.0.4"]
exclude: |
(?x)^(
release-controller/release_index.py
)$
args:
- --line-length=120
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
exclude: |
(?x)^(
release-controller/release_index.py
)$
args:
- --application-directories=.:gitlab-ci/src/
- repo: https://github.com/pycqa/flake8
rev: "7.0.0"
hooks:
- id: flake8
args: ["--config=flake8.cfg"]
- repo: https://github.com/pycqa/pydocstyle
rev: 5.1.1
hooks:
- id: pydocstyle
exclude: |
(?x)^(
release-controller/release_index.py
)$
args:
- --ignore=D100,D103,D104,D203,D212
# 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/PyCQA/pylint
rev: v2.17.7
hooks:
- id: pylint
name: pylint
exclude: |
(?x)^(
release-controller/release_index.py
)$
entry: python3 -m pylint.__main__
types: [python]
args: [
"-rn", # Only display messages
"-sn", # Don't display the score
"--disable=R,C,W0621,E0401,W0703,E1123", # Disable: Refactor, Convention, some warnings
]
additional_dependencies: # All necessary for successful PyLint in all environments
[
"pandas==1.5.3",
"elasticsearch==7.17.8",
"elasticsearch_dsl==7.4.0",
"requests",
"tabulate",
]
- repo: local
hooks:
- id: release-index-checks
language: system
name: release-index-checks
verbose: true
entry: |
bash -c '
files=("release-index-schema.json" "release-index.yaml" "release-controller/ci_check.py")
found=false
for file in "$@"; do
if [[ "${files[@]}" =~ "$file" ]]; then
found=true
break
fi
done
if [[ "$found" == false ]]; then
exit 0
fi
poetry run python release-controller/ci_check.py --repo-path ~/.cache/git/ic
'