-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.pre-commit-config.yaml
158 lines (158 loc) · 5.11 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
exclude: "doc/js/.*$|doc/theme/.*|doc/src/fonts/.*|doc/css/lineicon.css"
repos:
- repo: local
hooks:
- id: build-doc
name: Build documentation
entry: ./tools/ci/pre-commit/build_doc.sh --ros-version=humble
language: script
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
name: Check that merge conflicts are not being committed
- id: debug-statements
name: Detect accidentally committed debug statements
- id: check-builtin-literals
name: Require literal syntax when initializing Python builtin types
- id: detect-private-key
name: Detect if private key is added to the repository
- id: check-added-large-files
name: Detect if giant files are added
args: ["--maxkb=2000"]
- id: check-docstring-first
name: Checks for a common error of placing code before the docstring
- id: check-executables-have-shebangs
name: Check that executables have shebang
- id: check-shebang-scripts-are-executable
name: Checks that scripts with shebangs are executable
- id: check-json
name: Verify json syntax
- id: check-yaml
name: Verify yaml syntax
- id: check-toml
name: Verify toml syntax
- id: check-xml
name: Check XML files with xmllint
- id: name-tests-test
name: Assert that files in tests/ end in _test.py
- id: mixed-line-ending
name: Detect if mixed line ending is used (\r vs. \r\n)
- id: end-of-file-fixer
name: Make sure that there is an empty line at the end
exclude: "(.*.pgm|.*.dae|.*.sdf|.*.config|.*.svg|.*.mtl|requirements.txt)"
- id: trailing-whitespace
name: Remove trailing whitespace at end of line
- id: fix-encoding-pragma
name: Remove encoding header from python files
args: ["--remove"]
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.3
hooks:
- id: pycln
args: [--all]
- repo: https://github.com/ikamensh/flynt
rev: "0.78"
hooks:
- id: flynt
name: Run flynt string format converter for Python
exclude: |
(?x)
args:
# If flynt detects too long text it ignores it. So we set a very large limit to make it easy
# to split the text by hand. Too long lines are detected by flake8 (below),
# so the user is informed to take action.
- --line-length
- "99999"
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py310-plus]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
[
darglint,
flake8-alfred,
flake8-black,
flake8-builtins,
flake8-bugbear,
flake8-comprehensions,
flake8-copyright,
flake8-debugger,
flake8-executable,
flake8-logging-format,
flake8-pep3101,
flake8-quotes,
flake8-variables-names,
]
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
always_run: true
args: ["--config=./pyproject.toml", "."]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: http://github.com/ryanrhee/shellcheck-py
rev: v0.9.0.2
hooks:
- id: shellcheck
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-no-log-warn
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args:
[
-w,
--ignore-words=.codespell.txt,
-S,
"*.pgm,requirements*.txt,poetry.lock,tools/infrastructure/docker/config/grafana/dashboards/*",
]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
hooks:
- id: clang-format
- repo: https://github.com/hadolint/hadolint
rev: v2.12.1-beta
hooks:
- id: hadolint-docker
args: [--ignore, DL3008, --ignore, DL3005, --ignore, DL3013]
- repo: https://github.com/asottile/yesqa
rev: v1.4.0
hooks:
- id: yesqa
name: Remove unnecessary noqa statements
exclude: |
(?x)
additional_dependencies: ["flake8>=4.0.1"]
- repo: https://github.com/minipada/ros2_pre-commit.git
rev: 1.0.3
hooks:
- id: ros2_ws_same_versions
args: [--src=., --regex=dc_.*]
- id: ros2_ws_set_metadata
args: [--src=., --regex=dc_.*]
- repo: https://github.com/arrrrrmin/poetry-requirements
rev: 0.1.5
hooks:
- id: poetry-requirements
name: Check requirements.txt
args: [-o, requirements.txt, --without-hashes]
- id: poetry-requirements
name: Check requirements-dev.txt
args: [-o, requirements-dev.txt, --with, dev, --without-hashes]
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
- id: go-fmt