Skip to content

Commit

Permalink
enabled some clang-tidy warnings for non-GUI code (#5679)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
firewave authored Nov 20, 2023
1 parent 92c089d commit 3bafe16
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ 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,
-readability-identifier-naming,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-redundant-access-specifiers,
-readability-suspicious-call-argument,
-readability-uppercase-literal-suffix
WarningsAsErrors: '*'
Expand Down
20 changes: 11 additions & 9 deletions clang-tidy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`<br/>

Disabled because of false positives with Qt `slot` methods (see https://github.com/llvm/llvm-project/issues/57520).

`-clang-analyzer-*`<br/>

Disabled because of false positives (needs to file an upstream bug report).
Expand Down Expand Up @@ -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`<br/>

Reports warning with the Qt `<access-specifier> slots:` syntax in class declarations - see https://github.com/llvm/llvm-project/issues/60055.

`modernize-avoid-c-arrays`<br/>

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.
Expand Down Expand Up @@ -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.
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.
5 changes: 5 additions & 0 deletions gui/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
Checks: >
-readability-convert-member-functions-to-static,
-readability-redundant-access-specifiers
InheritParentConfig: true
5 changes: 5 additions & 0 deletions tools/triage/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
Checks: >
-readability-convert-member-functions-to-static,
-readability-redundant-access-specifiers
InheritParentConfig: true

0 comments on commit 3bafe16

Please sign in to comment.