-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
67 lines (57 loc) · 2.22 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
67 lines (57 loc) · 2.22 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
minimum_pre_commit_version: "3.7.0"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
files: &openfoam_cpp_files '\.(C|H|I|cc|cpp|cxx|hh|hpp|hxx)$'
exclude: &openfoam_excludes '(^|/)(lnInclude|ThirdParty|platforms|build|processor[0-9]+|postProcessing)/'
- id: end-of-file-fixer
files: *openfoam_cpp_files
exclude: *openfoam_excludes
- id: mixed-line-ending
args: [--fix=lf]
files: *openfoam_cpp_files
exclude: *openfoam_excludes
- id: check-merge-conflict
- id: check-yaml
- repo: local
hooks:
- id: openfoam-no-tabs
name: "OpenFOAM style: no tabs"
language: pygrep
entry: '\t'
files: *openfoam_cpp_files
exclude: *openfoam_excludes
# Manual for now because fixing long C++ lines usually requires judgment.
# Remove "stages: [manual]" once the existing codebase is clean.
- id: openfoam-max-80-columns
name: "OpenFOAM style: max 80 characters"
language: pygrep
entry: '^.{81,}$'
files: *openfoam_cpp_files
exclude: *openfoam_excludes
stages: [manual]
- id: openfoam-space-after-control-keyword
name: "OpenFOAM style: use if (...), for (...), while (...), switch (...)"
language: pygrep
entry: '^(?!\s*#).*\b(if|for|while|switch)\('
files: *openfoam_cpp_files
exclude: *openfoam_excludes
- id: openfoam-forall-no-space
name: "OpenFOAM style: use forAll(...), not forAll (...)"
language: pygrep
entry: '\b(forAll|forAllReverse|forAllIter|forAllConstIter|forAllIters|forAllConstIters)\s+\('
files: *openfoam_cpp_files
exclude: *openfoam_excludes
# Manual only: clang-format is useful as a helper, but it cannot exactly
# represent OpenFOAM stream/math/operator spacing conventions.
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.5
hooks:
- id: clang-format
name: "clang-format: approximate OpenFOAM style, requires manual changes"
args: [--style=file]
files: *openfoam_cpp_files
exclude: *openfoam_excludes
stages: [manual]