-
Notifications
You must be signed in to change notification settings - Fork 472
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
193 lines (173 loc) · 5.92 KB
/
.pre-commit-config.yaml
File metadata and controls
193 lines (173 loc) · 5.92 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
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
186
187
188
189
190
191
192
193
exclude: |
(?x)(
^bin/.* # bin/ at repo root
| ^third_party/.* # third_party/ at repo root
| .*\.(bat|BAT|dat|gtp)$ # .bat and a few similar
| .*\.(epw|stat|audit)$ # EnergyPlus specific files
)
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
# We exclude these because ddy/epw are treated as immutable, and the idf/imf etc are formatted by Transition tool probably
exclude: '.*\.(idf|imf|rvi|mvi|epw|ddy)$'
- id: check-merge-conflict
- id: check-yaml
- id: fix-byte-order-marker
- repo: https://github.com/psf/black
rev: 25.9.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 6.1.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v19.1.1'
hooks:
- id: clang-format
files: '^(src|tst)/.*\.(cpp|cc|c|hpp|hh|h)$'
args: ["-style=file", "--verbose"]
- repo: local
hooks:
# - id: test-hook
# name: test-hook
# entry: python scripts/dev/test_hook.py
# args: ['--verbose'] #, '--gha']
# language: python
# files: '.*\.cc'
# pass_filenames: true
# # I am handling concurrency in the script. Note that if you run with --all-files and do not add a filter, it might run twice or more, because of limitation in SC_ARG_MAX
# # (The maximum length of all arguments and environment strings to exec())
# # Passing about 2500 relative paths exceeds the limit so it MUST break it down in chunks anyways
# require_serial: true
- id: check-constexpr
name: check constexpr usage
entry: python scripts/dev/check_constexpr.py
args: ['--verbose']
language: python
files: '^src/EnergyPlus/.*\.(cc|hh)$|^tst/EnergyPlus/unit/.*\.(cc|hh)$'
pass_filenames: true
require_serial: true
- id: license-check
name: license check
entry: python scripts/dev/license-check.py
args: ['--verbose']
language: python
types_or: [python, c, c++]
pass_filenames: true
require_serial: true
- id: validate-idd-units
name: validate IDD units
entry: python scripts/dev/validate_idd_units.py
args: ['--verbose']
language: python
# files: '.*\.(idd.in|idd)'
files: '.*\.idd.in$' # The old IDDs will issue a ton of warnings
pass_filenames: true
require_serial: true
- id: check-stray-fields-in-idd
name: check stray fields in IDD
entry: python scripts/dev/check_stray_fields_in_idd.py
args: ['--verbose']
language: python
files: '.*\.idd.in$' # The old IDDs will issue a ton of warnings
pass_filenames: true
require_serial: true
- id: verify-idfs-in-cmake
name: verify IDFs in testfiles CMake
entry: python scripts/dev/verify_idfs_in_cmake.py
args: ['--verbose']
language: python
files: '^testfiles/.*\.(idf|imf)$|^testfiles/CMakeLists\.txt$'
pass_filenames: true
require_serial: true
- id: check-non-utf8
name: check files are UTF-8
entry: python scripts/dev/check_non_utf8.py
language: python
args: ['--fix', '--verbose']
pass_filenames: true
require_serial: true
- id: verify-cmake-dirs
name: verify cmake dirs
entry: python scripts/dev/verify_cmake_dirs.py
args: ['--verbose']
language: python
files: "^testfiles/.*"
pass_filenames: false
- id: find-byref-bool-override
name: find byref bool override
entry: python scripts/dev/find_byref_bool_override.py
args: ['--verbose']
language: python
files: '^src/EnergyPlus/.*\.cc$'
pass_filenames: true
require_serial: true
- id: check-for-tabs
name: check for tabs in IDFs
entry: python scripts/dev/check_for_tabs.py
language: python
args: ['--verbose']
files: '^testfiles/.*\.(idf|imf)$|^datasets/.*\.(idf|imf)$|.*\.idd.in$'
pass_filenames: true
require_serial: true
- id: find-included-cc-files
name: find included cc files
entry: python scripts/dev/find_included_cc_files.py
args: ['--verbose']
language: python
files: '^src/EnergyPlus/.*\.(cc|hh)$|^tst/EnergyPlus/unit/.*\.(cc|hh)$'
pass_filenames: true
require_serial: true
- id: analyze-state
name: analyze state
entry: python scripts/dev/analyze_state.py
args: ['--verbose']
language: python
files: '^src/EnergyPlus/Data/EnergyPlusData\.(cc|hh)$'
pass_filenames: false
- id: check-for-c-style-comments
name: check for C style comments
entry: python scripts/dev/check_for_c_style_comments.py
args: ['--verbose']
language: python
files: '^src/EnergyPlus/.*\.(cc|hh)$|^tst/EnergyPlus/unit/.*\.(cc|hh)$'
pass_filenames: true
require_serial: true
- id: check-for-switch-case-parentheses
name: check for switch case parentheses
entry: python scripts/dev/check_for_switch_case_parentheses.py
args: ['--verbose']
language: python
files: '^src/EnergyPlus/.*\.(cc|hh)$'
pass_filenames: true
require_serial: true
- id: check-for-malformed-enums
name: check for malformed enums
entry: python scripts/dev/check_for_malformed_enums.py
args: ['--verbose']
language: python
files: '^src/EnergyPlus/.*\.(cc|hh)$'
pass_filenames: true
require_serial: true
- id: check-format-strings
name: check format strings
entry: python scripts/dev/check_format_strings.py
args: ['--verbose']
language: python
files: '^src/EnergyPlus/.*\.(cc|hh)$|^tst/EnergyPlus/.*\.(cc|hh)$'
pass_filenames: true
require_serial: true
# This was taking 1min20 before, and 14s with parallel on my 16-thread machine but it's still too slow for a pre-commit hook, so manual only
# Run it with: pre-commit run --hook-stage manual check-for-enum-scope-usage --verbose --all-files
- id: check-for-enum-scope-usage
stages: [manual]
name: check_for_enum_scope_usage
entry: python scripts/dev/check_for_enum_scope_usage.py
args: ['--verbose']
language: python
pass_filenames: false