-
Notifications
You must be signed in to change notification settings - Fork 13
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
Use clang_tidy
instead of ament_clang_tidy
#135
Use clang_tidy
instead of ament_clang_tidy
#135
Conversation
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
…ctly to clang-tidy Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
BTW, I'm planning to migrate |
I have to double check why I didn't see those errors locally .... |
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivanpauno Left a few comments!
I'm guessing that ament_clang_tidy
was ignoring the test directory, so it wasn't instantiating some templates either.
clang_tidy
instead of ament_clang_tidy
Co-authored-by: Nahuel Espinosa <nespinosa@ekumenlabs.com> Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Exactly, https://github.com/ament/ament_lint/blob/a1b6c57be91b05ffa11d5eb6ff8700a478f1a890/ament_clang_tidy/ament_clang_tidy/main.py#L188-L189. |
Co-authored-by: Nahuel Espinosa <nespinosa@ekumenlabs.com> Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
That sounds like the way to go. It'd be neat to disambiguate between "couldn't run because dependencies are missing" and "there are issues with the code", to generate a warning or an error accordingly. |
I think it would be possible to do something like that if we have our own implementation of the pre-commit hook wrapper, but I don't think that's available in the existing wrapper. |
Related to #132.
Summary
Uses clang-tidy instead of ament_clang_tidy.
ament_clang_tidy
does not really pass all source files to clang-tidy, but some based on the compile commands.So I had to fix many warnings.
Something to discuss for a follow-up: clang-tidy still needs to be run inside the docker container because:
That can be solved by making the hook show a warning instead of failing when the compile commands cannot be generated or clang-tidy is not available.
e.g. using pre-commit/pre-commit#923 (comment).
For that, it would maybe be better to use a repo local entry instead of https://github.com/pocc/pre-commit-hooks, which isn't really doing much as it uses the locally installed clang-tidy.
On the other hand https://github.com/pre-commit/mirrors-clang-format provides much more, as it uses a python wheel that you can pin a clang-format version (and not the local one).
Other solutions:
Checklist