2022-09-16 07:16:35 +02:00
# clang-tidy
Below are the reasoning why certain checks are (currently) disabled for out code base
## Externals
We do not perform static analysis of the source of the external libraries. `simplecpp` has its own CI with a clang-tidy workflow.
## Disabled Checks
2023-08-09 12:45:15 +02:00
`abseil-*` < br />
`altera-*` < br />
`android-*` < br />
`boost-*` < br />
`darwin-*` < br />
`fuchsia-*` < br />
`linuxkernel-*` < br />
`llvm-*` < br />
`llvmlibc-*` < br />
`mpi-*` < br />
`objc-*` < br />
`openmp-*` < br />
`zircon-*` < br />
2022-09-16 07:16:35 +02:00
These are disabled since the platforms/libraries in question are not targeted by us.
2023-08-09 12:45:15 +02:00
`cert-*` < br />
`cppcoreguidelines-*` < br />
`google-*` < br />
`hicpp-*` < br />
2022-09-16 07:16:35 +02:00
These are coding guidelines we do not follow. Some of the checks might be explicitly enabled though.
2023-08-09 12:45:15 +02:00
`readability-braces-around-statements` < br />
`readability-isolate-declaration` < br />
`modernize-use-trailing-return-type` < br />
`modernize-use-auto` < br />
`readability-uppercase-literal-suffix` < br />
`readability-else-after-return` < br />
`readability-identifier-length` < br />
2022-09-16 07:16:35 +02:00
2023-08-08 11:05:02 +02:00
These do not reflect the style we are (currently) enforcing.
2022-09-16 07:16:35 +02:00
2023-08-09 12:45:15 +02:00
`readability-function-size` < br />
`readability-function-cognitive-complexity` < br />
2022-09-16 07:16:35 +02:00
2023-08-08 11:05:02 +02:00
We are not interested in the size/complexity of a function.
2022-09-16 07:16:35 +02:00
2023-08-09 12:45:15 +02:00
`readability-magic-numbers` < br />
2022-09-16 07:16:35 +02:00
2022-09-27 06:48:06 +02:00
These do not (always) increase readability.
2022-09-16 07:16:35 +02:00
2023-08-09 12:45:15 +02:00
`bugprone-macro-parentheses` < br />
2022-09-16 07:16:35 +02:00
To be documented.
2023-08-09 12:45:15 +02:00
`readability-implicit-bool-conversion` < br />
2023-02-15 19:46:13 +01:00
2023-08-08 11:05:02 +02:00
This does not appear to be useful as it is reported on very common code.
2023-02-15 19:46:13 +01:00
2023-08-09 12:45:15 +02:00
`bugprone-narrowing-conversions` < br />
`performance-no-automatic-move` < br />
2022-09-16 07:16:35 +02:00
It was decided not to apply these.
2023-08-09 12:45:15 +02:00
`modernize-loop-convert` < br />
2022-09-16 07:16:35 +02:00
These might change the behavior of code which might not be intended (need to file an upstream issue)
2023-08-09 12:45:15 +02:00
`modernize-raw-string-literal` < br />
2022-09-16 07:16:35 +02:00
This leads to a mismatch of raw string literals and regular ones and does reduce the readability.
2023-08-09 12:45:15 +02:00
`-clang-analyzer-*` < br />
2022-09-16 07:16:35 +02:00
2023-02-15 19:46:13 +01:00
Disabled because of false positives (needs to file an upstream bug report).
2022-09-16 07:16:35 +02:00
2023-08-09 12:45:15 +02:00
`misc-non-private-member-variables-in-classes` < br />
2022-09-16 07:16:35 +02:00
2023-02-15 19:46:13 +01:00
We intentionally use this.
2022-09-16 07:16:35 +02:00
2023-08-09 12:45:15 +02:00
`misc-no-recursion` < br />
2022-09-16 07:16:35 +02:00
Leads to lots of "false positives". This seem to enforce a coding guidelines of certain codebases.
2023-08-09 12:45:15 +02:00
`bugprone-easily-swappable-parameters` < br />
2022-09-16 07:16:35 +02:00
This produces a lot of noise and they are not fixable that easily.
2023-08-09 12:45:15 +02:00
`readability-container-data-pointer` < br />
2022-09-16 07:16:35 +02:00
Disable because of false positives and inconsistent warnings (need to file an upstream bug report).
2023-08-09 12:45:15 +02:00
`misc-const-correctness` < br />
2022-09-16 07:16:35 +02:00
Work in progress.
2023-08-09 12:45:15 +02:00
`bugprone-assignment-in-if-condition` < br />
2022-09-16 07:16:35 +02:00
Is reported for valid patterns we are using.
2023-08-09 12:45:15 +02:00
`readability-suspicious-call-argument` < br />
2022-09-16 18:58:59 +02:00
Produces a lot of false positives since it is too vague in its analysis.
2023-08-09 12:45:15 +02:00
`performance-inefficient-string-concatenation` < br />
2022-09-16 18:58:59 +02:00
2023-02-15 19:46:13 +01:00
Produces warnings which might be considered false positives starting with C++11 - see https://github.com/llvm/llvm-project/issues/54526.
2023-08-09 12:45:15 +02:00
`modernize-avoid-c-arrays` < br />
2023-02-15 19:46:13 +01:00
Produces warnings when `const char[]` is being used which is quite common in our code. Does not make sense to enable before C++17 when `std::string_view` becomes available.
Also reports a false positive about templates which deduce the array length: https://github.com/llvm/llvm-project/issues/60053.
2023-08-09 12:45:15 +02:00
`misc-include-cleaner` < br />
2022-09-16 07:16:35 +02:00
2023-08-09 12:45:15 +02:00
We run this separately via `clang-include-cleaner` in the `iwyu.yml` workflow as the findings of the include checkers still need to be reviewed manually before applying them.
2022-09-16 07:16:35 +02:00
2023-08-09 12:45:15 +02:00
`bugprone-branch-clone` < br />
`readability-const-return-type` < br />
`modernize-return-braced-init-list` < br />
`misc-throw-by-value-catch-by-reference` < br />
`readability-avoid-const-params-in-decls` < br />
`bugprone-signed-char-misuse` < br />
`readability-redundant-access-specifiers` < br />
`concurrency-mt-unsafe` < br />
`misc-use-anonymous-namespace` < br />
`performance-avoid-endl` < br />
`performance-noexcept-swap` < br />
`bugprone-switch-missing-default-case` < br />
`bugprone-empty-catch` < br />
To be evaluated (need to remove exclusion).
`cppcoreguidelines-missing-std-forward` < br />
`cppcoreguidelines-avoid-const-or-ref-data-members` < br />
2023-08-31 09:04:51 +02:00
`cppcoreguidelines-macro-usage` < br />
`cppcoreguidelines-pro-type-member-init` < br />
`cppcoreguidelines-pro-type-static-cast-downcast` < br />
`cppcoreguidelines-prefer-member-initializer` < br />
`cppcoreguidelines-misleading-capture-default-by-value` < br />
`bugprone-argument-comment.CommentBoolLiterals` < br />
`cert-err33-c` < br />
`google-readability-namespace-comments` < br />
`cppcoreguidelines-special-member-functions` < br />
2023-08-09 12:45:15 +02:00
To be evaluated (need to enable explicitly).
2023-10-26 14:55:59 +02:00
`modernize-type-traits` </ br >
`modernize-use-nodiscard` </ br >
These apply to codebases which use later standards then C++11 (C++17 is used when building with Qt6) so we cannot simply apply them.
2023-11-15 11:24:25 +01:00
### Disabled for performance reasons
2023-08-09 12:45:15 +02:00
`portability-std-allocator-const` < br />
2022-09-16 07:16:35 +02:00
Only necessary for code which is exclusively compiled with `libc++` . Also disabled for performance reasons - see https://github.com/llvm/llvm-project/issues/57527#issuecomment-1237935132.
2023-08-09 12:45:15 +02:00
`modernize-deprecated-ios-base-aliases` < br />
2022-09-16 07:16:35 +02:00
Warns about aliases which are removed in C++20. Also disabled for performance reasons - see https://github.com/llvm/llvm-project/issues/57527#issuecomment-1237935132.
2023-08-09 12:45:15 +02:00
`bugprone-unchecked-optional-access` < br />
2022-09-16 07:16:35 +02:00
We are not using any `optional` implementation. Also disabled for performance reasons - see https://github.com/llvm/llvm-project/issues/57527#issuecomment-1237935132.
2023-08-09 12:45:15 +02:00
`modernize-replace-auto-ptr` < br />
2022-09-16 07:16:35 +02:00
Still available until C++17. It is unlikely such code will ever be introduced. Also disabled for performance reasons - see https://github.com/llvm/llvm-project/issues/57527#issuecomment-1237935132.
2023-08-09 12:45:15 +02:00
`readability-identifier-naming` < br />
2022-09-16 07:16:35 +02:00
We are currently using our own `naming.json` to enforce naming schemes. Also disabled for performance reasons - see https://github.com/llvm/llvm-project/issues/57527#issuecomment-1237935132.
2023-08-09 12:45:15 +02:00
`portability-simd-intrinsics` < br />
2022-09-16 07:16:35 +02:00
We are not using SIMD instructions and it suggests to use `std::experiemental::` features which might not be commonly available. Also disabled for performance reasons - see https://github.com/llvm/llvm-project/issues/57527#issuecomment-1237935132.
2023-11-15 11:24:25 +01:00
`modernize-macro-to-enum` < br />
It does not seem to produce any warnings for us (needs to be investigated) and it is one of the more expensive checks.
`misc-unused-using-decls`
This is the most expensive check for several files and it is providing much in terms of code quality. Reported upstream as https://github.com/llvm/llvm-project/issues/72300.
`modernize-use-nullptr`
2023-11-20 10:06:46 +01:00
This is already covered by the `-Wzero-as-null-pointer-constant` compiler warning so there is no need for an additional check.
### Disabled for GUI only
`readability-convert-member-functions-to-static` < br />
Disabled because of false positives with Qt `slot` methods (see https://github.com/llvm/llvm-project/issues/57520).
`readability-redundant-access-specifiers` < br />
Reports warning with the Qt `<access-specifier> slots:` syntax in class declarations - see https://github.com/llvm/llvm-project/issues/60055.