From 3bafe164a3d8063c5cecb28aa397e274acf50aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Mon, 20 Nov 2023 10:06:46 +0100 Subject: [PATCH] enabled some clang-tidy warnings for non-GUI code (#5679) There are some clang-tidy warnings which cannot properly handle the extensions used in the Qt code so the produce lots of false positives and were previously enabled. With clang-tidy now offering the possibility to inherit the parent configuration we can enable these across the project and simply disable them for the GUI code. No additional warnings were found as they were already fixed in earlier commits without enabling the checks in question. --- .clang-tidy | 2 -- clang-tidy.md | 20 +++++++++++--------- gui/.clang-tidy | 5 +++++ tools/triage/.clang-tidy | 5 +++++ 4 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 gui/.clang-tidy create mode 100644 tools/triage/.clang-tidy diff --git a/.clang-tidy b/.clang-tidy index b721e1b9461..e96c20ed6dd 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -61,7 +61,6 @@ Checks: > -readability-braces-around-statements, -readability-const-return-type, -readability-container-data-pointer, - -readability-convert-member-functions-to-static, -readability-function-cognitive-complexity, -readability-function-size, -readability-identifier-length, @@ -69,7 +68,6 @@ Checks: > -readability-implicit-bool-conversion, -readability-isolate-declaration, -readability-magic-numbers, - -readability-redundant-access-specifiers, -readability-suspicious-call-argument, -readability-uppercase-literal-suffix WarningsAsErrors: '*' diff --git a/clang-tidy.md b/clang-tidy.md index a31fea4a915..1b9c0aef180 100644 --- a/clang-tidy.md +++ b/clang-tidy.md @@ -71,10 +71,6 @@ These might change the behavior of code which might not be intended (need to fil This leads to a mismatch of raw string literals and regular ones and does reduce the readability. -`readability-convert-member-functions-to-static`
- -Disabled because of false positives with Qt `slot` methods (see https://github.com/llvm/llvm-project/issues/57520). - `-clang-analyzer-*`
Disabled because of false positives (needs to file an upstream bug report). @@ -112,10 +108,6 @@ Produces a lot of false positives since it is too vague in its analysis. Produces warnings which might be considered false positives starting with C++11 - see https://github.com/llvm/llvm-project/issues/54526. -`readability-redundant-access-specifiers`
- -Reports warning with the Qt ` slots:` syntax in class declarations - see https://github.com/llvm/llvm-project/issues/60055. - `modernize-avoid-c-arrays`
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. @@ -196,4 +188,14 @@ This is the most expensive check for several files and it is providing much in t `modernize-use-nullptr` -This is already covered by the `-Wzero-as-null-pointer-constant` compiler warning so there is no need for an additional check. \ No newline at end of file +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`
+ +Disabled because of false positives with Qt `slot` methods (see https://github.com/llvm/llvm-project/issues/57520). + +`readability-redundant-access-specifiers`
+ +Reports warning with the Qt ` slots:` syntax in class declarations - see https://github.com/llvm/llvm-project/issues/60055. diff --git a/gui/.clang-tidy b/gui/.clang-tidy new file mode 100644 index 00000000000..8a62240d85a --- /dev/null +++ b/gui/.clang-tidy @@ -0,0 +1,5 @@ +--- +Checks: > + -readability-convert-member-functions-to-static, + -readability-redundant-access-specifiers +InheritParentConfig: true diff --git a/tools/triage/.clang-tidy b/tools/triage/.clang-tidy new file mode 100644 index 00000000000..8a62240d85a --- /dev/null +++ b/tools/triage/.clang-tidy @@ -0,0 +1,5 @@ +--- +Checks: > + -readability-convert-member-functions-to-static, + -readability-redundant-access-specifiers +InheritParentConfig: true