-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.pre-commit-config.yaml
185 lines (185 loc) · 5.64 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
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
repos:
- repo: https://github.com/timothycrosley/isort
rev: 5.11.4
hooks:
- id: isort
types: [python]
args: [--filter-files]
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
args: [--line-length, '79']
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
exclude: scripts/robot_msgs/
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: [--rcfile=setup.cfg]
exclude: scripts/robot_msgs/
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
exclude: scripts/robot_msgs/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
hooks:
- id: mypy
exclude: scripts/robot_msgs/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
args: [--maxkb=100]
exclude: '.*[.]ipynb$'
- id: check-ast
- id: check-builtin-literals
- id: fix-byte-order-marker
- id: check-case-conflict
# - id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
# - id: check-xml
- id: check-yaml
args: [--allow-multiple-documents]
- id: debug-statements
- id: end-of-file-fixer
exclude: '.*[.](urdf|obj|lcm|lcmlog)$'
- id: mixed-line-ending
args: [--fix=lf]
- id: no-commit-to-branch
args: [--branch, master]
- id: pretty-format-json
args: [--autofix, --indent, '4', --no-ensure-ascii]
- id: requirements-txt-fixer
- id: trailing-whitespace
exclude: '.*[.](urdf|obj|lcm|lcmlog)$'
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.4.2
hooks:
- id: forbid-crlf
- id: remove-crlf
- id: forbid-tabs
- id: remove-tabs
args: [ '--whitespaces-count', '2' ] # defaults to: 4
- id: insert-license
alias: insert-license-cpp
name: insert-license-cpp
files: '[.](cc|h)$'
exclude: |
(?x)^(
externals/
|src/examples/
)$
args: [
--license-filepath,
LICENSE,
--comment-style,
/*| *| */,
--fuzzy-match-generates-todo,
--fuzzy-ratio-cut-off,
"50",
--detect-license-in-X-top-lines=10 # defaults to 5
]
- id: insert-license
alias: insert-license-py/sh
name: insert-license-py/sh
files: '[.](py|sh)$'
exclude: |
(?x)^(
externals/
)$
args: [
--license-filepath,
LICENSE,
--comment-style,
"#",
--fuzzy-match-generates-todo,
--fuzzy-ratio-cut-off,
"50",
--detect-license-in-X-top-lines=10 # defaults to 5
]
# below are C++ hooks ordered by speed, benchmark time on a single source file
# * clang-format 0.7 s
# * cpplint 0.7 s
# * cppcheck 34.1 s
# * oclint 47.9 s
# * clang-tidy 438.8 s
- repo: local
hooks:
- id: compile-commands
name: Export compile commands for static code analyses
language: system
entry: ./compile_commands_export.sh
always_run: true
- repo: https://github.com/bmorcos/pre-commit-hooks-cpp
rev: 9a5aa38207bf557961110d6a4f7e3a9d352911f9
hooks:
- id: clang-format
args: [--style=file]
exclude: |
(?x)^(
externals/.*
)$
- id: cpplint
# Some C++11 headers are unapproved by Google style; ignore that.
args: [
--verbose=0,
--counting=toplevel,
--recursive,
"--filter=-build/c++11,-runtime/references,-whitespace/newline"]
exclude: |
(?x)^(
externals/.*
)$
- id: cppcheck
# manual: http://cppcheck.sourceforge.net/manual.pdf
# need fix_ros_escape.sh due to the following error before running this
# error: bad macro syntax. macroname=ROS_PACKAGE_NAME value=\"stuff_getter\" [internalError]
# the -i exclusion option doesn't work with --project
args: ["--enable=all",
"--std=c++20",
"--language=c++",
"--inline-suppr",
"--quiet",
"--project=build/compile_commands_escape-diff_only.json",
# suppress external libraries warnings
"--suppress=*:*/externals/*",
# suppress ompl header warnings
"--suppress=*:/usr/*",
"--suppress=*:/opt/drake/*",
# "--suppress=missingInclude",
# If DRAKE_DEPRECATED is a macro then please configure it. [unknownMacro]
"--suppress=unknownMacro",
# [eigen] warning: Found suspicious operator ',' [constStatement]
"--suppress=constStatement",
"--suppress=unmatchedSuppression",
# unused function is always positive when running on a small subset of codebase
"--suppress=unusedFunction"
]
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: oclint
# keep the original compile_commands.json as oclint requires it
args: [-p=build/compile_commands-diff_only.json,
-enable-clang-static-analyzer,
-enable-global-analysis,
"--extra-arg=-I/usr/include/clang/13/include"]
- id: clang-tidy
args: [-p=build/compile_commands-diff_only.json,
--config-file=.clang-tidy]
# - id: uncrustify
# doesn't seem to add much more value, to be evaluated further
# - id: cppcheck
# the cppcheck in this repo doesn't print any ouput when not passing