I want the python script run-clang-tidy
to:
- check files with
.cc
,.h
, or.hpp
extension - exclude anything in any folder called
build
For example,
- check
<project folder>/src/../include/solitaire/helloworld.h
- exclude
<project folder>/build/<folder>/catch_reporters_all.hpp
I try the following:
cd <project folder>
# -- Make a `compiled_commands.json` -- #
mkdir build
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
# -- Run in the build folder -- #
run-clang-tidy '^((?!/build/).)*(\.cc|\.h)$' \
-header-filter '(\.cc|\.h|.hpp)$'
But it reports warning for:
<project folder>/build/_deps/catch2-src/src/catch2/
../catch2/reporters/catch_reporters_all.hpp:21:9:
error: header guard does not follow preferred style
[llvm-header-guard,-warnings-as-errors]
Setting the -header-filter
option to '^((?!/build/).)*(\.cc|\.h|.hpp)$'
still doesn't work.
That would exclude helloworld.h
:
<project folder>/src/../include/solitaire/helloworld.h:1:1:
error: header is missing header guard
[llvm-header-guard,-warnings-as-errors]
What went wrong?