-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Shift clang-tidy
to github action
#28566
Comments
clang-tidy is currently disabled pending resolution here |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions. |
can we prioritize this? I genuinely think this is really bad for the long term as it directly affects the code quality plus security risk |
its half complete - atm you can run: ./ci/do_ci.sh clang-tidy and it kinda works the reason i didnt land in ci is that it is not 100% - i took someone elses (aspect-based) clang-tidy implementation and hacked a few things to make it work to my expectations i havent had too much time to do it recently - but in the past i ran it and fixed any issues - probably that would be a good place to start - the tool could do with some non-me testing and feedback |
so yeah one thing I noticed is
can we exclude external? |
I think that would save tons of CPU times in CI |
good q - i never really got to the bottom of this i think it does exclude it to the extent that it doesnt throw errors - at least using the do_ci.sh way - but i have always been convinced that its checking a lot more than it should |
meanwhile I will fix the errors and warning emitted currently little by little |
also noticed that
|
Also noticed that clang-tidy runs multiple times each time included == if a file That's the reason why it's running on edited: maybe the find-and-run style won't work if the file include the thirparty stuff... maybe I am missing something though |
I found the root cause of why it's running multiple times on the same file:
the newly introduced toolshed clang-tidy runs clang-tidy on each file but our .clang-tidy.yaml tells it to emit warning for all envoy repo headers. We definitely should invoke clang-tidy once, not on each file... |
can we revert #29848 and bring the compilation_db+manual clang-tidy invocation back? I think that's much simpiler |
basically using aspect (i assume that runs on each build target) for clang-tidy seems not the right way |
no!!! really lets not - that way was awful and the general advice is to shift to aspects for this kind of job what is the issue you are having? bazel certainly adds some overhead but it has its uses also |
the point about using aspects - iiuc - is that you dont need to compile everything to run it |
ok, the issue is it's running clang-tidy on each header/source files hence whenever |
hmm, sounds like a job for (remote) persistent workers perhaps i think this is the issue that i was saying about it running more than it should tbh - not sure - it was a while ago i worked on it iiuc it does need to do this analysis even if its not testing those files? |
if you pass all files all at once to clang, then clang analyze once no matter how many times they are included elsewhere vs using aspect this runs on each time, so the context is missing. But anyways nvm not that important for now. I think asap we should do is to bring this to CI - could you clarify what's the missing steps to close issue? |
part of #28566 Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
created empty header file and manually run clang-tidy (with the compilation_commands.json) and the error disappears with c++17 but comes in c++20. So i think the problem is something to do with our -config=clang build settings regarding the standard library. This is the exact line where the error emitted - I suspect that some system headers somehow avoided being recognized as a system header. The same error is not observable with the real clang (not clang-tidy) compilation, so I think this might be a bug of clang-tidy. Maybe we should remove |
i should have mentioned - we only saw this appear after updating to c++20 |
#37408 finally found the fix! |
Previously, `redefining builtin macro [clang-diagnostic-builtin-macro-redefined,-warnings-as-errors]` was reported despite the existence of the `-Wno-builtin-macro-redefined` in the compiler argument. This is a known issue for older version of clang as in * llvm/llvm-project#56709 * erenon/bazel_clang_tidy#29 The workaround discussed was to explicitly add `-clang-diagnostic-builtin-macro-redefined` in the checks of clang-tidy, which can be removed after we upgrade to LLVM 17. part of #28566 Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
part of #28566 --------- Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
part of #28566 Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> Co-authored-by: phlax <phlax@users.noreply.github.com>
maybe we want to revive the ignored targets here Lines 40 to 94 in 22e7328
|
part of #28566 Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
part of #28566 Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
part of #28566 --------- Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
part of #28566 Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
part of #28566 Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@phlax do you have any update |
no - ive been busy with other things |
been a while since my last run, but now I get this build error. Looks like foreign CC is trying to compile everything during the clang-tidy target? |
thats odd - i think the aspect just pulls in the sources - nothing should be built iirc |
fwiw im hitting the same issue when trying to run the aspect in staging |
hmm - not 100% certain but i think its not building its configuring (ie |
actually - not - the
so it seems it is building stuff |
we definitely should prioritize this as until then we end up dealing with random broken builds like this over and over again |
i tried reverting recent update to |
it would appear that the breaking change is the bazel update - reverting bazel to 6.5.0 fixes |
same failure on 7.0.0 - so it appears to be some change in 7.x that is causing this checking further - and aspects should not, at least in ordinary circumstances build nodes/deps - however if the required file/s (ie headers) are declared as outputs of the rule but not declared independently then bazel will ~correctly conclude that the rule/target has to be built in order to get to the headers - i think that is what is happening here if that is correct then i guess the foreign_cc targets probably were always getting built - the breaking bazel update is most likely that now when building the env/context/inputs are not being passed through correctly |
Currently clang-tidy is not working very well and need some attention
I am gradually picking off various bits of ci for shifting azp -> gh
This one seems like quite a good candidate to start on the checks with.
The text was updated successfully, but these errors were encountered: