-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clang-tidy config for neuland and core
- Loading branch information
Showing
11 changed files
with
191 additions
and
61 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
config/clang_tidy/default.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Configuration for clang-tidy | ||
|
||
## Setup configuration file | ||
Warnings given by clang-tidy or clangd are configured in `.clang-tidy` yaml file in the nearest folder. Detector specific folders can have different configurations defined in the [global.yml](./global.yml). The customary configuration files in folders for a detector should be symbolic links to a common file located at `config/clang_tidy/${detector_name}.yml`. | ||
|
||
Currently there are 3 different folders for each detector: | ||
* `R3BRoot/${detector_name}/` | ||
* `R3BRoot/r3bsource/${detector_name}/` | ||
* `R3BRoot/r3bdata/${detector_name}Data/` | ||
|
||
Here is an example of how to create 3 symbolic links in the folders related to NeuLAND: | ||
```shell | ||
# in project root folder | ||
ln -s ../config/clang_tidy/neuland.yml ./neuland/.clang-tidy | ||
ln -s ../../config/clang_tidy/neuland.yml ./r3bsource/neuland/.clang-tidy | ||
ln -s ../../config/clang_tidy/neuland.yml ./r3bdata/neulandData/.clang-tidy | ||
``` | ||
|
||
## Suppressing undesired warnings | ||
|
||
Ways to ignore certain warnings among the code can be found in [clang-tidy official website](https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics). | ||
|
||
Here is a summary with some examples (copied directly from the website): | ||
|
||
1. `NOLINT` | ||
```cpp | ||
// Suppress all the diagnostics for the line | ||
Foo(int param); // NOLINT | ||
|
||
// Consider explaining the motivation to suppress the warning | ||
Foo(char param); // NOLINT: Allow implicit conversion from `char`, because <some valid reason> | ||
|
||
// Silence only the specified checks for the line | ||
Foo(double param); // NOLINT(google-explicit-constructor, google-runtime-int) | ||
|
||
// Silence all checks from the `google` module | ||
Foo(bool param); // NOLINT(google*) | ||
|
||
// Silence all checks ending with `-avoid-c-arrays` | ||
int array[10]; // NOLINT(*-avoid-c-arrays | ||
``` | ||
2. `NOLINTNEXTLINE` | ||
```cpp | ||
// Silence only the specified diagnostics for the next line | ||
// NOLINTNEXTLINE(google-explicit-constructor, google-runtime-int) | ||
Foo(bool param); | ||
// Silence all checks from the `google` module for the next line | ||
// NOLINTNEXTLINE(google*) | ||
Foo(bool param); | ||
// Silence all checks ending with `-avoid-c-arrays` for the next line | ||
// NOLINTNEXTLINE(*-avoid-c-arrays) | ||
int array[10]; | ||
``` | ||
|
||
3. `NOLINTBEGIN` and `NOLINTEND` | ||
```cpp | ||
// Silence only the specified checks for all lines between the BEGIN and END | ||
// NOLINTBEGIN(google-explicit-constructor, google-runtime-int) | ||
Foo(short param); | ||
Foo(long param); | ||
// NOLINTEND(google-explicit-constructor, google-runtime-int) | ||
|
||
// Silence all checks from the `google` module for all lines between the BEGIN and END | ||
// NOLINTBEGIN(google*) | ||
Foo(bool param); | ||
// NOLINTEND(google*) | ||
|
||
// Silence all checks ending with `-avoid-c-arrays` for all lines between the BEGIN and END | ||
// NOLINTBEGIN(*-avoid-c-arrays) | ||
int array[10]; | ||
// NOLINTEND(*-avoid-c-arrays) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# vi: ft=yaml | ||
Checks: > | ||
-*, | ||
bugprone-*, | ||
cert-dcl21-cpp, | ||
cert-dcl50-cpp, | ||
cert-env33-c, | ||
cert-err34-c, | ||
cert-err52-cpp, | ||
cert-err60-cpp, | ||
cert-flp30-c, | ||
cert-msc50-cpp, | ||
cert-msc51-cpp, | ||
clang-analyzer-*, | ||
cppcoreguidelines-*, | ||
-cppcoreguidelines-pro-type-reinterpret-cast, | ||
google-build-using-namespace, | ||
google-explicit-constructor, | ||
google-global-names-in-headers, | ||
google-readability-casting, | ||
google-runtime-int, | ||
google-runtime-operator, | ||
hicpp-*, | ||
-hicpp-vararg, | ||
misc-*, | ||
modernize-*, | ||
performance-*, | ||
readability-*, | ||
-hicpp-new-delete-operators, | ||
-modernize-use-trailing-return-type | ||
CheckOptions: | ||
- key: bugprone-argument-comment.StrictMode | ||
value: 1 | ||
- key: bugprone-easily-swappable-parameters.MinimumLength | ||
value: 4 | ||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||
value: 1 | ||
- key: readability-identifier-length.IgnoredVariableNames | ||
value: '^it$' | ||
- key: readability-magic-numbers.IgnoreAllFloatingPointValues | ||
value: 'true' | ||
- key: cppcoreguidelines-avoid-magic-numbers.IgnoreAllFloatingPointValues | ||
value: 'true' | ||
- key: readability-function-cognitive-complexity.Threshold | ||
value: 40 | ||
- key: readability-function-cognitive-complexity.IgnoreMacros | ||
value: 'true' | ||
|
||
FormatStyle: 'file' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Checks: > | ||
-*, | ||
cppcoreguidelines-pro-type-cstyle-cast, | ||
WarningsAsErrors: '' | ||
HeaderFilterRegex: '' | ||
AnalyzeTemporaryDtors: false | ||
FormatStyle: none | ||
User: land | ||
CheckOptions: | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# vi: ft=yaml | ||
Checks: > | ||
-*, | ||
bugprone-*, | ||
cert-dcl21-cpp, | ||
cert-dcl50-cpp, | ||
cert-env33-c, | ||
cert-err34-c, | ||
cert-err52-cpp, | ||
cert-err60-cpp, | ||
cert-flp30-c, | ||
cert-msc50-cpp, | ||
cert-msc51-cpp, | ||
clang-analyzer-*, | ||
cppcoreguidelines-*, | ||
-cppcoreguidelines-pro-type-reinterpret-cast, | ||
google-build-using-namespace, | ||
google-explicit-constructor, | ||
google-global-names-in-headers, | ||
google-readability-casting, | ||
google-runtime-int, | ||
google-runtime-operator, | ||
hicpp-*, | ||
-hicpp-vararg, | ||
misc-*, | ||
modernize-*, | ||
performance-*, | ||
readability-* | ||
CheckOptions: | ||
- key: bugprone-argument-comment.StrictMode | ||
value: 1 | ||
- key: bugprone-easily-swappable-parameters.MinimumLength | ||
value: 4 | ||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||
value: 1 | ||
- key: readability-identifier-length.IgnoredVariableNames | ||
value: '^it$' | ||
- key: readability-magic-numbers.IgnoredFloatingPointValues | ||
value: '1.0;2.0;10.0;100.0;1000.0' | ||
- key: readability-function-cognitive-complexity.Threshold | ||
value: 40 | ||
- key: readability-function-cognitive-complexity.IgnoreMacros | ||
value: 'true' | ||
|
||
FormatStyle: 'file' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../config/clang_tidy/neuland.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../config/clang_tidy/core.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../config/clang_tidy/neuland.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../config/clang_tidy/core.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../config/clang_tidy/neuland.yml |