erenon / bazel_clang_tidy

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

Add target to apply clang-tidy fixes #39

Open oliverlee opened 1 year ago

oliverlee commented 1 year ago

When I run the example with:

bazel build //example --aspects clang_tidy/clang_tidy.bzl%clang_tidy_aspect --output_groups=report

this silently succeeds. If instead I run

bazel build //... --aspects clang_tidy/clang_tidy.bzl%clang_tidy_aspect --output_groups=report

I get the expected lint warning.

I get tidy fixes applied with

bazel run :apply_fixes

or

bazel run :apply_fixes -- //...
gou4shi1 commented 10 months ago

any update?

MiaoDX commented 7 months ago

@oliverlee

Hi, tried to use the fix patch, however, it seems to be confused by sandbox.

I tried to add back no-sandbox inside https://github.com/erenon/bazel_clang_tidy/commit/99ed470c25033baafe9ddd0634bc269f15b64b16, it succeed in fixing the std::string problem.

dongxu@MiDX01:~/ws/micah/tmp/bazel_clang_tidy$ bazelisk run :apply_fixes //...
INFO: Invocation ID: 2334cead-3d8a-4851-9396-e18a3046da53
INFO: Analyzed target //:apply_fixes (1 packages loaded, 1 target configured).
INFO: Found 1 target...
Target //:apply_fixes up-to-date:
  bazel-bin/clang_tidy.apply_fixes.sh
INFO: Elapsed time: 0.045s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/clang_tidy.apply_fixes.sh //...
Described file '/home/dongxu/.cache/bazel/_bazel_dongxu/7cea99f25702216cc5bfbca1e10eeac0/sandbox/linux-sandbox/11/execroot/bazel_clang_tidy/example/lib.cpp' doesn't exist. Ignoring...
Described file '/home/dongxu/.cache/bazel/_bazel_dongxu/7cea99f25702216cc5bfbca1e10eeac0/sandbox/linux-sandbox/11/execroot/bazel_clang_tidy/example/lib.hpp' doesn't exist. Ignoring...