Skip to content

Commit

Permalink
clang-tidy: Ignore the external directory
Browse files Browse the repository at this point in the history
The external directory contains code for external librairies. It
should not be inspected by clang-tidy.

The regex syntax does not allow to directly ignore a directory. Solve
this issue by adding a `clang-tidy` config file in the external
directory which disables all the checks.

See:
https://stackoverflow.com/questions/74349432/clang-tidy-exclude-specific-dir-from-analysis
See:
https://stackoverflow.com/questions/58338202/cmake-clang-tidy-disable-checking-in-directory
See: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/777/diffs
  • Loading branch information
ptitjano committed Feb 19, 2025
1 parent f028ef1 commit ac21a8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Checks: 'bugprone-*,-bugprone-easily-swappable-parameters,-bugprone-virtual-near-miss,-bugprone-suspicious-include'
HeaderFilterRegex: ''
4 changes: 4 additions & 0 deletions external/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# clang-tidy does not allow easy deactivation of a directory.
# Use a dummy .clang-tidy file that disables all clang-tidy checks except one that will never match.
# This one check is necessary; clang-tidy reports an error when no checks are enabled.
Checks: '-*,llvm-twine-local'

0 comments on commit ac21a8d

Please sign in to comment.