Skip to content

Commit 59fdb82

Browse files
committed
Add a pre-commit config
1 parent 3ea842b commit 59fdb82

File tree

112 files changed

+2334
-1834
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2334
-1834
lines changed

.clang-format

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# SPDX-FileCopyrightText: 2019-2024 SeisSol Group
1+
# SPDX-FileCopyrightText: 2021 SeisSol Group
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
4+
# SPDX-LicenseComments: Full text under /LICENSE and /LICENSES/
5+
#
6+
# SPDX-FileContributor: Author lists in /AUTHORS and /CITATION.cff
47

5-
---
68
Language: Cpp
7-
# BasedOnStyle: LLVM
8-
AccessModifierOffset: -2
9+
AccessModifierOffset: -4
910
AlignAfterOpenBracket: Align
1011
AlignConsecutiveMacros: false
1112
AlignConsecutiveAssignments: false
@@ -16,7 +17,7 @@ AlignTrailingComments: true
1617
AllowAllArgumentsOnNextLine: true
1718
AllowAllConstructorInitializersOnNextLine: true
1819
AllowAllParametersOfDeclarationOnNextLine: true
19-
AllowShortBlocksOnASingleLine: Never
20+
AllowShortBlocksOnASingleLine: false
2021
AllowShortCaseLabelsOnASingleLine: false
2122
AllowShortFunctionsOnASingleLine: All
2223
AllowShortLambdasOnASingleLine: All
@@ -25,9 +26,9 @@ AllowShortLoopsOnASingleLine: false
2526
AlwaysBreakAfterDefinitionReturnType: None
2627
AlwaysBreakAfterReturnType: None
2728
AlwaysBreakBeforeMultilineStrings: false
28-
AlwaysBreakTemplateDeclarations: MultiLine
29-
BinPackArguments: true
30-
BinPackParameters: true
29+
AlwaysBreakTemplateDeclarations: Yes
30+
BinPackArguments: false
31+
BinPackParameters: false
3132
BraceWrapping:
3233
AfterCaseLabel: false
3334
AfterClass: false
@@ -54,14 +55,13 @@ BreakConstructorInitializersBeforeComma: false
5455
BreakConstructorInitializers: BeforeColon
5556
BreakAfterJavaFieldAnnotations: false
5657
BreakStringLiterals: true
57-
ColumnLimit: 120
58+
ColumnLimit: 100
5859
CommentPragmas: '^ IWYU pragma:'
5960
CompactNamespaces: false
6061
ConstructorInitializerAllOnOneLineOrOnePerLine: false
6162
ConstructorInitializerIndentWidth: 4
6263
ContinuationIndentWidth: 4
6364
Cpp11BracedListStyle: true
64-
DeriveLineEnding: true
6565
DerivePointerAlignment: false
6666
DisableFormat: false
6767
ExperimentalAutoDetectBinPacking: false
@@ -70,24 +70,22 @@ ForEachMacros:
7070
- foreach
7171
- Q_FOREACH
7272
- BOOST_FOREACH
73-
IncludeBlocks: Preserve
73+
IncludeBlocks: Regroup
7474
IncludeCategories:
75+
# keep the doctest headers in front
76+
- Regex: '^(<|")doctest'
77+
Priority: 1
7578
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
76-
Priority: 2
77-
SortPriority: 0
78-
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
7979
Priority: 3
80-
SortPriority: 0
80+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
81+
Priority: 4
8182
- Regex: '.*'
82-
Priority: 1
83-
SortPriority: 0
83+
Priority: 2
8484
IncludeIsMainRegex: '(Test)?$'
85-
IncludeIsMainSourceRegex: ''
8685
IndentCaseLabels: false
87-
IndentGotoLabels: true
8886
IndentPPDirectives: None
8987
IndentWidth: 2
90-
IndentWrappedFunctionNames: false
88+
IndentWrappedFunctionNames: true
9189
JavaScriptQuotes: Leave
9290
JavaScriptWrapImports: true
9391
KeepEmptyLinesAtTheStartOfBlocks: true
@@ -107,7 +105,8 @@ PenaltyBreakString: 1000
107105
PenaltyBreakTemplateDeclaration: 10
108106
PenaltyExcessCharacter: 1000000
109107
PenaltyReturnTypeOnItsOwnLine: 60
110-
PointerAlignment: Right
108+
PointerAlignment: Left
109+
QualifierAlignment: Left
111110
ReflowComments: true
112111
SortIncludes: true
113112
SortUsingDeclarations: true
@@ -120,22 +119,16 @@ SpaceBeforeCtorInitializerColon: true
120119
SpaceBeforeInheritanceColon: true
121120
SpaceBeforeParens: ControlStatements
122121
SpaceBeforeRangeBasedForLoopColon: true
123-
SpaceInEmptyBlock: false
124122
SpaceInEmptyParentheses: false
125123
SpacesBeforeTrailingComments: 1
126124
SpacesInAngles: false
127-
SpacesInConditionalStatement: false
128125
SpacesInContainerLiterals: true
129126
SpacesInCStyleCastParentheses: false
130127
SpacesInParentheses: false
131128
SpacesInSquareBrackets: false
132-
SpaceBeforeSquareBrackets: false
133-
Standard: Latest
129+
Standard: Cpp11
134130
StatementMacros:
135131
- Q_UNUSED
136132
- QT_REQUIRE_VERSION
137133
TabWidth: 8
138-
UseCRLF: false
139134
UseTab: Never
140-
...
141-

.clang-tidy

Lines changed: 115 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,92 @@
1-
# SPDX-FileCopyrightText: 2019-2024 SeisSol Group
1+
# SPDX-FileCopyrightText: 2022 SeisSol Group
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
4+
# SPDX-LicenseComments: Full text under /LICENSE and /LICENSES/
5+
#
6+
# SPDX-FileContributor: Author lists in /AUTHORS and /CITATION.cff
7+
8+
# TODO: apply
9+
# * modernize-use-trailing-return-type
10+
# * readability-function-size
11+
# * cppcoreguidelines-pro-type-const-cast
12+
# * readability-convert-member-functions-to-static
13+
# * clang-analyzer-cplusplus.NewDeleteLeaks
14+
# * clang-analyzer-optin.cplusplus.VirtualCall
15+
# * clang-analyzer-deadcode.DeadStores
16+
# * bugprone-narrowing-conversions,
17+
# * bugprone-easily-swappable-parameters,
18+
# * bugprone-unchecked-optional-access,
19+
# * bugprone-crtp-constructor-accessibility,
20+
# * bugprone-branch-clone,
21+
# * cppcoreguidelines-use-enum-class
22+
# * google-runtime-int
423

5-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-llvm-header-guard,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
6-
#WarningsAsErrors: 'readability-identifier-naming'
24+
Checks:
25+
- google-*
26+
- -google-readability-todo
27+
- -google-runtime-int
28+
- -google-build-using-namespace
29+
- -google-default-arguments
30+
- cert-*
31+
- -cert-err58-cpp
32+
- openmp-*
33+
- -openmp-use-default-none
34+
- concurrency-*
35+
- -clang-analyzer-cplusplus.NewDeleteLeaks
36+
- -clang-analyzer-optin.cplusplus.VirtualCall
37+
- -clang-analyzer-deadcode.DeadStores
38+
- bugprone-*
39+
- -bugprone-narrowing-conversions
40+
- -bugprone-easily-swappable-parameters
41+
- -bugprone-unchecked-optional-access
42+
- -bugprone-crtp-constructor-accessibility
43+
- -bugprone-branch-clone
44+
- clang-diagnostic-*
45+
- cppcoreguidelines-*
46+
- -cppcoreguidelines-avoid-c-arrays
47+
- -cppcoreguidelines-avoid-const-or-ref-data-members
48+
- -cppcoreguidelines-avoid-magic-numbers
49+
- -cppcoreguidelines-avoid-do-while
50+
- -cppcoreguidelines-macro-usage
51+
- -cppcoreguidelines-no-malloc
52+
- -cppcoreguidelines-non-private-member-variables-in-classes
53+
- -cppcoreguidelines-pro-bounds-array-to-pointer-decay
54+
- -cppcoreguidelines-pro-bounds-constant-array-index
55+
- -cppcoreguidelines-owning-memory
56+
- -cppcoreguidelines-pro-bounds-pointer-arithmetic
57+
- -cppcoreguidelines-pro-type-reinterpret-cast
58+
- -cppcoreguidelines-narrowing-conversions
59+
- -cppcoreguidelines-pro-type-const-cast
60+
- -cppcoreguidelines-use-enum-class
61+
- llvm-*
62+
- -llvm-else-after-return
63+
- -llvm-header-guard
64+
- -llvm-qualified-auto
65+
- -llvm-prefer-static-over-anonymous-namespace
66+
- misc-*
67+
- -misc-non-private-member-variables-in-classes
68+
- -misc-no-recursion
69+
- modernize-*
70+
- -modernize-avoid-c-arrays
71+
- -modernize-deprecated-headers
72+
- -modernize-loop-convert
73+
- -modernize-pass-by-value
74+
- -modernize-return-braced-init-list
75+
- -modernize-use-trailing-return-type
76+
- mpi-*
77+
- performance-*
78+
- -performance-enum-size
79+
- -performance-avoid-endl
80+
- readability-*
81+
- -readability-else-after-return
82+
- -readability-identifier-length
83+
- -readability-magic-numbers
84+
- -readability-math-missing-parentheses
85+
- -readability-function-cognitive-complexity
86+
- -readability-function-size
87+
- -readability-suspicious-call-argument
88+
- -readability-convert-member-functions-to-static
89+
WarningsAsErrors: '*'
790
CheckOptions:
891
# - key: readability-identifier-naming.AbstractClassCase
992
# value: CamelCase
@@ -22,7 +105,7 @@ CheckOptions:
22105
# - key: readability-identifier-naming.ClassConstantPrefix
23106
# value: CamelCase
24107
# - key: readability-identifier-naming.ClassConstantSuffix
25-
# value: CamelCase-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,
108+
# value: CamelCase
26109
# - key: readability-identifier-naming.ClassMemberCase
27110
# value: CamelCase
28111
# - key: readability-identifier-naming.ClassMemberPrefix
@@ -36,7 +119,7 @@ CheckOptions:
36119
# - key: readability-identifier-naming.ClassMethodSuffix
37120
# value: CamelCase
38121
- key: readability-identifier-naming.ConstantCase
39-
value: UPPER_CASE
122+
value: camelBack
40123
# - key: readability-identifier-naming.ConstantPrefix
41124
# value: CamelCase
42125
# - key: readability-identifier-naming.ConstantSuffix
@@ -71,8 +154,8 @@ CheckOptions:
71154
# value: CamelCase
72155
# - key: readability-identifier-naming.ConstexprMethodSuffix
73156
# value: CamelCase
74-
# - key: readability-identifier-naming.ConstexprVariableCase
75-
# value: CamelCase
157+
- key: readability-identifier-naming.ConstexprVariableCase
158+
value: CamelCase
76159
# - key: readability-identifier-naming.ConstexprVariablePrefix
77160
# value: CamelCase
78161
# - key: readability-identifier-naming.ConstexprVariableSuffix
@@ -95,8 +178,8 @@ CheckOptions:
95178
# value: CamelCase
96179
# - key: readability-identifier-naming.FunctionSuffix
97180
# value: CamelCase
98-
# - key: readability-identifier-naming.GlobalConstantCase
99-
# value: CamelCase
181+
- key: readability-identifier-naming.GlobalConstantCase
182+
value: CamelCase
100183
# - key: readability-identifier-naming.GlobalConstantPrefix
101184
# value: CamelCase
102185
# - key: readability-identifier-naming.GlobalConstantSuffix
@@ -159,10 +242,12 @@ CheckOptions:
159242
# value: CamelCase
160243
- key: readability-identifier-naming.MemberCase
161244
value: camelBack
162-
- key: readability-identifier-naming.MemberPrefix
163-
value: ""
245+
- key: readability-identifier-naming.MemberIgnoredRegexp
246+
value: "^m_|_$" # TODO: temporary! Remove after more refactoring.
247+
# - key: readability-identifier-naming.MemberPrefix
248+
# value: ""
164249
# - key: readability-identifier-naming.MemberSuffix
165-
# value: CamelCase
250+
# value: ""
166251
# - key: readability-identifier-naming.MethodCase
167252
# value: CamelCase
168253
# - key: readability-identifier-naming.MethodPrefix
@@ -229,8 +314,8 @@ CheckOptions:
229314
# value: CamelCase
230315
# - key: readability-identifier-naming.PublicMethodSuffix
231316
# value: CamelCase
232-
# - key: readability-identifier-naming.StaticConstantCase
233-
# value: CamelCase
317+
- key: readability-identifier-naming.StaticConstantCase
318+
value: CamelCase
234319
# - key: readability-identifier-naming.StaticConstantPrefix
235320
# value: CamelCase
236321
# - key: readability-identifier-naming.StaticConstantSuffix
@@ -247,26 +332,26 @@ CheckOptions:
247332
# value: CamelCase
248333
# - key: readability-identifier-naming.StructSuffix
249334
# value: CamelCase
250-
# - key: readability-identifier-naming.TemplateParameterCase
251-
# value: CamelCase
335+
- key: readability-identifier-naming.TemplateParameterCase
336+
value: CamelCase
252337
# - key: readability-identifier-naming.TemplateParameterPrefix
253338
# value: CamelCase
254339
# - key: readability-identifier-naming.TemplateParameterSuffix
255340
# value: CamelCase
256-
# - key: readability-identifier-naming.TemplateTemplateParameterCase
257-
# value: CamelCase
341+
- key: readability-identifier-naming.TemplateTemplateParameterCase
342+
value: CamelCase
258343
# - key: readability-identifier-naming.TemplateTemplateParameterPrefix
259344
# value: CamelCase
260345
# - key: readability-identifier-naming.TemplateTemplateParameterSuffix
261346
# value: CamelCase
262-
# - key: readability-identifier-naming.TypeAliasCase
263-
# value: CamelCase
347+
- key: readability-identifier-naming.TypeAliasCase
348+
value: CamelCase
264349
# - key: readability-identifier-naming.TypeAliasPrefix
265350
# value: CamelCase
266351
# - key: readability-identifier-naming.TypeAliasSuffix
267352
# value: CamelCase
268-
# - key: readability-identifier-naming.TypedefCase
269-
# value: CamelCase
353+
- key: readability-identifier-naming.TypedefCase
354+
value: CamelCase
270355
# - key: readability-identifier-naming.TypedefPrefix
271356
# value: CamelCase
272357
# - key: readability-identifier-naming.TypedefSuffix
@@ -301,3 +386,11 @@ CheckOptions:
301386
# value: CamelCase
302387
# - key: readability-identifier-naming.VirtualMethodSuffix
303388
# value: CamelCase
389+
390+
# ignore Eigen, yaml-cpp, and HDF5 manually, until added to IWYU
391+
# Eigen needs to ignore Eigen/Core and Eigen/Eigenvalues, until we make Eigen3 5.0.0 mandatory
392+
# also, ignore internal GCC headers (bits/)
393+
- key: misc-include-cleaner.IgnoreHeaders
394+
value: 'bits/.*|external/.*'
395+
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
396+
value: True

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2019-2024 SeisSol Group
1+
# SPDX-FileCopyrightText: 2019 SeisSol Group
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
44

.gitlab-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# SPDX-FileCopyrightText: 2019-2024 SeisSol Group
1+
# SPDX-FileCopyrightText: 2019 SeisSol Group
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
44

55
stages:
6-
- adjust
6+
- adjust
77
- test
88
- miscellaneous
99

@@ -60,7 +60,7 @@ basic_example:
6060
- *common_test_script
6161
- export WORKDIR=./examples/basic/build
6262
- mkdir -p ${WORKDIR} && cd ${WORKDIR}
63-
- cmake .. -DDEVICE_BACKEND=${BACKEND} -DSM=${GPU_MODEL} -DREAL_SIZE_IN_BYTES=4
63+
- cmake .. -DDEVICE_BACKEND=${BACKEND} -DSM=${GPU_MODEL} -DREAL_SIZE_IN_BYTES=4
6464
- make -j4
6565
- ./basic
6666

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2019-2024 SeisSol Group
1+
# SPDX-FileCopyrightText: 2019 SeisSol Group
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
44

0 commit comments

Comments
 (0)