erenon / bazel_clang_tidy

Run clang-tidy on Bazel C++ targets directly, efficiently, with caching enabled
MIT License
96 stars 51 forks source link

Bazel does not cache clang-tidy reports #41

Open damien-projectx opened 1 year ago

damien-projectx commented 1 year ago

Running the same command twice runs clang-tidy on all the files each time, which seems to indicate that the reports are not cached. Command used:

bazel build --config=clang-tidy //...

.bazelrc

build:clang-tidy --copt=-I/usr/local/local_archive/googletest-release-1.12.1/googletest/include
build:clang-tidy --copt=-I/usr/local/local_archive/googletest-release-1.12.1/googlemock/include
build:clang-tidy --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
build:clang-tidy --output_groups=report
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_config=//:.clang-tidy
build:clang-tidy --build_tag_filters=-no-clang-tidy

Also, we need to use --copt=-I to add the paths to the header files for local repositories despite the fact that these headers are already referenced in cc_library().

Thank you for your help.