-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy path.pre-commit-config.yaml
138 lines (124 loc) · 4.42 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
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.6
hooks:
- id: clang-format
name: Format C/C++
# Only use on C and C++ files and not on other files that clang could format (e.g. json).
types_or: [c++, c]
exclude: 'mm$'
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
name: Format cmake
args: [--config, utilities/code_checks/.cmake-format.yaml, --in-place]
additional_dependencies: [pyyaml>=5.1]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 22.3.0
hooks:
- id: black
name: Format python
- repo: https://github.com/pamoller/xmlformatter
rev: v0.2.6
hooks:
- id: xml-formatter
name: Format xml
args: [--indent, '2', --indent-char, ' ', --selfclose, --overwrite]
# Only run on "pure" XML files and not on files that internally use XML (e.g. svg)
files: \.xml$
- repo: https://github.com/google/yamlfmt
rev: v0.12.1
hooks:
- id: yamlfmt
name: Format yaml
args: [-conf, utilities/code_checks/.yamlfmt.yaml]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
name: Trim trailing whitespace
# Do not modify reference vtu files, since we generate these and do not hand-edit them.
exclude: 'vtu$'
- id: no-commit-to-branch
name: Don't commit to main
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: insert-license
name: Insert license header (//)
types_or: [c++, c]
exclude: 'mm$'
args:
- --license-filepath
- utilities/license_header.txt
- --comment-style
- '//'
- --detect-license-in-X-top-lines=1
- id: insert-license
name: Insert license header (#)
types_or: [python, cmake, dockerfile, shell]
args:
- --license-filepath
- utilities/license_header.txt
- --comment-style
- '#'
# Allow the first line to be a shebang separated by a newline.
- --detect-license-in-X-top-lines=3
- repo: https://github.com/crate-ci/typos
rev: v1.28.4
hooks:
- id: typos
name: Check for typos in code
types_or: [c++, c, python, cmake, shell]
exclude: '(mm$|list_of_tests.cmake)'
- id: typos
name: Check for typos in documentation
types_or: [markdown, rst]
- repo: local
hooks:
- id: check-venv-up-to-date
name: Python virtual environment is up to date
language: system
entry: ./utilities/code_checks/check_venv
always_run: true
pass_filenames: false
fail_fast: true
- id: check-dependencies-hash
name: Github workflow dependencies hash is up to date
language: python
entry: utilities/python-venv/bin/check-workflow-dependencies-hash
always_run: true
pass_filenames: false
- id: cpp-filename-includes
name: C++ file names and include style
description: 'Check that all C++ files have the correct file name and include style'
language: system
types_or: [c++, c]
exclude: 'tests/cut_test/|mm$'
entry: utilities/python-venv/bin/check-filenames-and-includes
args: ['--paths', 'src/', 'unittests/', 'apps/', '--files']
- id: cpp-include-guard
name: Include guards
description: 'Check that all C++ files have the correct include guards'
language: python
types_or: [c++, c]
files: '\.(h|hpp)$'
entry: utilities/python-venv/bin/check-header-guards
- id: cpp-preprocessor
name: C++ preprocessor directives
description: 'Check that all C++ files only use acceptable preprocessor directives'
language: python
types_or: [c++, c]
entry: utilities/python-venv/bin/check-preprocessor
- id: input-files
name: Test input files
description: 'Check input files conform to expectations'
language: python
files: 'tests/input_files/.*\.dat$'
entry: utilities/python-venv/bin/check-test-files
- id: non-ascii-chars
name: Non-ASCII characters
language: system
exclude_types: [markdown, rst]
entry: ./utilities/code_checks/check_non_ascii_chars