Open thehans opened 1 year ago
@llvm/issue-subscribers-clang-tidy
Clang tidy uses the check options from the file it was invoked on, so header files take the options of source files that include them.
Is it not possible to process headers independently from the sources which include them?
To do that you'd need to disable clang-tidy running on header files, then invoke clang-tidy on the header. For this to work properly you'd need all your header files to be self contained.
I have a project where I want to enable most of clang-tidy's
modernize-*
checks, includingmodernize-use-nodiscard
. However there seems to be a problem where Qt MOC cannot parse[[nodiscard]]
when building this on older platforms like Ubuntu 18.04 and 20.04.The Qt specific files in this project are all under
src/gui/
path, so I thought that I could place a.clang-tidy
file there with contents:To me this means that it should use all the other top-level-enabled checks except
modernize-use-nodiscard
. But for whatever reason, headers don't seem to follow.clang-tidy
settings (only the top level one though?)I don't understand why a header filter exists but not a general filename filter. Why is the interface for checking headers so obscure and difficult compared to the rest of source files?