-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration with bazel-compile-commands-extractor #20
Comments
I wonder if @cpsauer can help expose some of the things that bazel_clang_tidy needs. It seems that adding |
Hey, @aminya! My understanding is that clangd embeds clang-tidy these days, providing feedback as you edit if you want. So if you're already using clangd and generating a compile_commands.json with our tool, maybe that'd be a good way to get automated style feedback! Would love to hear your experience with that if you end up trying it. [It looks like the goal of this project is a little different. They're looking to accommodate folks without a compile_commands.json (or clangd) and provide the style feedback as a build-style error. That's great stuff, but you've got the compile_commands.json and clangd already, I think. (All that said, I'm no clang-tidy expert (yet)--nor experienced with this project, so please tell me if I'm wrong or it there's a key integration we should be making.)] Cheers, |
P.S. For generated files, you'll want to have flags match when you build and when you use the tools! It's definitely a tricky thing to handle well for tool builders. |
My issue with clangd's clang-tidy is that it doesn't show all the issues in the workspace to me. I need to open each file to trigger it. It also doesn't seem to work when a function is templated. I have to call that template in my tests to trigger those warnings. That's why running clang-tidy form CLI shows more warnings that are not shown by clangd. |
Oh, got it. Makes sense. To confirm, is the draw of this tool, then, over just running clang-tidy directly w/ the compile_commands.json, speed, since it takes care of caching via bazel? Seems like some of the same questions remain, though: Is this tool designed to take a compile_commands.json file if you supply one? |
It is not, there's no need for a json file |
Hey, Thaler! Great to meet another Bazel toolmaker. Seems like a great thing you've built here. |
I realized that with the help of hedronvision/bazel-compile-commands-extractor, running clang-tidy becomes just a matter of specifying the # first generate compile_commands.json
bazel run refresh_compile_commands -- --config=debug --compilation_mode=dbg # run clang-tidy on cpp files
files=$(git ls-files --exclude-standard | grep -E '\.(cpp|c|cc|cxx)$')
clang-tidy -p ./ $files
# -p ./ specifies the path of the folder that compile_command.json is generated It might be worthwhile adding this to the readme files. |
@aminya, yeah! That's what I meant. You mean adding it to our README, yeah? |
@aminya, I'm creating an issue to track over at hedronvision/bazel-compile-commands-extractor#52 |
bazel-compile-commands-extractor can generate compiled_commands.json files. I tried to hot patch the shell binary and add
-p $PROJECT_ROOT
to the clang-tidy command. However, it seems that still clang-tidy fails to find some headers.https://github.com/hedronvision/bazel-compile-commands-extractor
The issue seems to be a mismatch between the config and compilation mode. bazel-compile-commands-extractor accepts extra flags like
-- --config=debug --compilation_mode=dbg
, but bazel_clang_tidy uses fastbuild by default.The text was updated successfully, but these errors were encountered: