-
Notifications
You must be signed in to change notification settings - Fork 44
/
.pre-commit-config.yaml
173 lines (172 loc) · 5.72 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
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
# More recent versions are built against GLIBC_2.28+. We want to keep it compatible with
# Amazon Linux 2 (GLIBC_2.26)
node: "16.19.0"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: static/.*\.[js|css]
- id: end-of-file-fixer
exclude: static/.*\.[js|css]
- id: mixed-line-ending
args: [--fix=lf]
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-yaml
exclude: cfn-templates
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: debug-statements
- id: destroyed-symlinks
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: detect-private-key
- repo: local
hooks:
- id: replace-c-headers
name: replace-c-headers
entry: |
sed -i -e 's/#include <stdint.h>/#include <cstdint>/'
-e 's/#include <stddef.h>/#include <cstddef>/'
-e 's/#include <stdlib.h>/#include <cstdlib>/'
-e 's/#include <math.h>/#include <cmath>/'
-e 's/#include <string.h>/#include <cstring>/'
-e 's/#include <ctype.h>/#include <cctype>/'
-e 's/#include <stdio.h>/#include <cstdio>/'
-e 's/#include <time.h>/#include <ctime>/'
-e 's/#include <limits.h>/#include <climits>/'
language: system
verbose: true
types: [c++]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v12.0.1
hooks:
- id: clang-format
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.0
hooks:
- id: autoflake
name: autoflake
args:
[
"--in-place",
"--remove-unused-variables",
"--remove-all-unused-imports",
"--expand-star-imports",
]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
args: [--safe]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.12.0]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4 # Some plugins still require <6
hooks:
- id: flake8
additional_dependencies:
- flake8-implicit-str-concat==0.3.0
- pep8-naming==0.13.3
- flake8-bugbear==22.12.6
- flake8-broken-line==0.6.0
- flake8-comprehensions==3.10.1
- flake8-builtins==2.1.0
- flake8-pytest-style==1.6.0
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
exclude: static/.*\.[js|css]
- repo: local
hooks:
- id: validate-static-config
name: validate-static-config
entry:
check-jsonschema --schemafile
interfaces/protobuf/schemas/edgeConfiguration/staticConfiguration.json --
language: python
files: "configuration/static-config.json|tools/android-app/app/src/main/assets/config-0.json"
types: [json]
additional_dependencies: ["check-jsonschema==0.25.0", "urllib3==1.26.17"]
verbose: true
- id: validate-persistency-metadata
name: validate-persistency-metadata
entry:
check-jsonschema --schemafile
interfaces/persistency/schemas/persistencyMetadataFormat.json --
language: python
files: "interfaces/persistency/examples/persistencyMetadataFormat.json"
types: [json]
additional_dependencies: ["check-jsonschema==0.25.0", "urllib3==1.26.17"]
verbose: true
- id: validate-build-files
name: validate-build-files
entry: |
bash -e -c '
VIOLATION=false
for FILE in "$@"; do
if ! grep -q "${FILE}" CMakeLists.txt; then
echo "${FILE} is missing from CMakeLists.txt"
VIOLATION=true
fi
done
if ${VIOLATION}; then exit -1; fi
' --
language: python
files: "^src|^test/unit"
exclude: "^test/unit/support"
types: [c++]
verbose: true
- id: forbid-tabs
name: forbid-tabs
language: pygrep
entry: "\\t"
types: [text]
exclude: \.dbc|static/.*\.[js|css]
- id: forbid-non-ascii-chars
name: forbid-non-ascii-chars
language: pygrep
entry: "[\\x80-\\xFF]"
types: [text]
- id: ensure-copyright-header
name: ensure-copyright-header
entry: |
bash -e -c '
VIOLATION=false
for FILE in "$@"; do
if ! head -n2 "${FILE}" | grep -q "Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved."; then
echo "${FILE} is missing copyright headers"
VIOLATION=true
fi
done
if ${VIOLATION}; then exit -1; fi
' --
language: python
types_or: [c++, python, yaml, cmake, proto, shell]
exclude: "gradlew|.prettierrc.yaml|.clang-format|.clang-tidy|create_avd_config.sh"
verbose: true
- repo: https://github.com/AlexanderDokuchaev/md-dead-link-check
rev: "v0.9"
hooks:
- id: md-dead-link-check