Hi,
Currently clang-tidy uses the .clang-tidy file closest to the “.cpp” file under analysis. This means it can pick up warnings from a “.h” file that is next to a totally different .clang-tidy file. This leads to confusion as to “which config is used to analyze which file”.
This is problematic also when trying to ignore warnings from 3rd-party libraries. The current solution is to use HeaderFilterRegex, to prevent warnings from e.g. 3rd-party folders, but then this filter needs to be duplicated in many places depending on the directory structure. That’s not ideal. On top of that, HeaderFilterRegex doesn’t support negative regexes (it’s a “filter-in” regex, not “filter-out”).
Would it be possible to implement this:
https://clang.llvm.org/extra/clang-tidy/checks/readability-identifier-naming.html#cmdoption-arg-getconfigperfile
for all checks? Potentially opt-in via CLI/config. In other words, have clang-tidy use the .clang-tidy file closest to where an identifier is declared (the root of the problem), not where it’s used.
Looking forward to your thoughts!