forked from espressif/arduino-esp32
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
152 lines (139 loc) · 4.54 KB
/
.pre-commit-config.yaml
File metadata and controls
152 lines (139 loc) · 4.54 KB
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
exclude: |
(?x)(
^\.github\/|
^tests\/performance\/coremark\/.*\.[ch]$|
^tests\/performance\/superpi\/.*\.(cpp|h)$|
LICENSE\.md$
)
default_language_version:
# force all unspecified python hooks to run python3
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b" # v5.0.0
hooks:
# Generic checks
- id: check-case-conflict
name: Check for Case Conflicts
- id: check-symlinks
name: Check for Broken Symlinks
- id: debug-statements
name: Check for Debug Statements
- id: destroyed-symlinks
name: Check for Destroyed Symlinks
- id: detect-private-key
name: Check for Private Keys
- id: end-of-file-fixer
name: Fix End of File Formatting
exclude: ^.*\.(bin|BIN)$
- id: mixed-line-ending
name: Fix Mixed Line Endings
args: [--fix=lf]
- id: trailing-whitespace
name: Fix Trailing Whitespace
args: [--markdown-linebreak-ext=md]
# JSON formatting
- id: pretty-format-json
name: Fix JSON Formatting
stages: [manual]
args: [--autofix]
types_or: [json]
exclude: |
(?x)(
diagram\..*\.json$|
package\.json$|
^package\/.*$
)
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "f6446549e5e97ec9665b9b03e75b87b445857f9a" # v18.1.3
hooks:
# C/C++ formatting
- id: clang-format
name: Format C/C++ code using Clang Format
types_or: [c, c++]
exclude: ^.*\/build_opt\.h$
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "a4920527036bb9a3f3e6055d595849d67d0da066" # 25.1.0
hooks:
# Python formatting
- id: black
name: Format Python code using Black
types_or: [python]
args: [--line-length=120] #From the arduino code style. Add as argument rather than creating a new config file.
- repo: https://github.com/PyCQA/flake8
rev: "16f5f28a384f0781bebb37a08aa45e65b9526c50" # 7.2.0
hooks:
# Python linting
- id: flake8
name: Lint Python code using Flake8
types_or: [python]
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "ffb6a759a979008c0e6dff86e39f4745a2d9eac4" # v3.1.0
hooks:
# YAML formatting
- id: prettier
name: Format YAML code using Prettier
types_or: [yaml]
- repo: https://github.com/codespell-project/codespell
rev: "63c8f8312b7559622c0d82815639671ae42132ac" # v2.4.1
hooks:
# Spell checking
- id: codespell
name: Check spelling in code using Codespell
exclude: ^.*\.(svd|SVD)$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "a23f6b85d0fdd5bb9d564e2579e678033debbdff" # v0.10.0.1
hooks:
# Bash linting
- id: shellcheck
name: Lint Bash code using Shellcheck
types: [shell]
- repo: https://github.com/openstack/bashate
rev: "fbd7c2534c2701351c603ff700ddf08202430a31" # 2.1.1
hooks:
# Bash formatting
- id: bashate
name: Lint Bash code using Bashate
types: [shell]
args: ["-i", "E006"] # Ignore E006: Line too long
- repo: local
hooks:
- id: arduino-include-checker
name: Check for Arduino.h include
entry: .github/scripts/include_checker.py
language: python
files: ^.*\.ino$
- repo: https://github.com/errata-ai/vale
rev: "dc4c47923788a413fb5677de6e3370d514aecb78" # v3.11.2
hooks:
# Sync vale styles and lint markdown and reStructuredText
- id: vale
name: Sync Vale styles
language_version: "1.23.2"
pass_filenames: false
args: [sync]
types_or: [markdown, rst]
- id: vale
name: Lint markdown and reStructuredText using Vale
language_version: "1.23.2"
types_or: [markdown, rst]
# Always leave this last to ensure that all hooks have already run
- repo: local
hooks:
- id: git-diff
name: Check if changes were made by the pre-commit hooks
entry: |
bash -c '
if [ "$CI" = "true" ]; then
if git diff --exit-code; then
echo "pending_commit=0" >> $GITHUB_OUTPUT
else
echo "pending_commit=1" >> $GITHUB_OUTPUT
fi
fi
'
language: system