Skip to content
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

aspect clang-tidy.yaml is being produced but not printed to terminal #87

Open
nickdesaulniers opened this issue Mar 19, 2025 · 3 comments

Comments

@nickdesaulniers
Copy link

I swear I had this working where following the readme, I could simply build with the addition of --config=clang-tidy and the errors found would be printed to the terminal. But today I'm only seeing:

$ bazel build //some:path --config=clang-tidy
...
Aspect @@bazel_clang_tidy+//clang_tidy:clang_tidy.bzl%clang_tidy_aspect of //some:path up-to-date:
  bazel-bin/some/bazel_clang_tidy_arch/path.cpp.some.clang-tidy.yaml
...

And path.cpp.some.clang-tidy.yaml looks like machine parseable list of diagnostics from clang-tidy. How come they didn't print to my terminal? I tried bisecting back to when I first introduced bazel_clang_tidy to our codebase, but I still don't see output to terminal. I swear I used to. How do I go about debugging what might have changed in my environment?

@nickdesaulniers
Copy link
Author

Another clue; it seems this behavior depends on the target or where in my tree I'm trying to run.
Example:

$ bazel build //some:path --config=clang-tidy
...
Aspect @@bazel_clang_tidy+//clang_tidy:clang_tidy.bzl%clang_tidy_aspect of //some:path up-to-date:
  bazel-bin/some/bazel_clang_tidy_arch/path.cpp.some.clang-tidy.yaml
...
$ bazel build //other:path --config=clang-tidy
<warnings as expected>

@nickdesaulniers
Copy link
Author

Perhaps I'm misunderstanding the workflow, if I have a clang-diagnostic-error (from indirect header includes), then I see the error and other warnings as expected. Without any errors (from clang-diagnostic-error), I don't see any warnings...what?!

My code compiles fine, I don't understand why bazel_clang_tidy seems to be testing my headers standalone.

@erenon
Copy link
Owner

erenon commented Mar 23, 2025

Please share your .clang-tidy, if possible. Do you have WarningsAsErrors set? (see example: https://github.com/erenon/bazel_clang_tidy/blob/master/.clang-tidy )

If clang-tidy returns 0 after run, bazel considers the check successful, and swallows the output (I suppose).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants