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

Add --packages-select to ament_clang_tidy #287

Merged
merged 1 commit into from
Jan 20, 2021

Conversation

tylerjw
Copy link
Contributor

@tylerjw tylerjw commented Jan 10, 2021

Signed-off-by: Tyler Weaver tylerjw@gmail.com

Description

This adds a way to filter based on the package name. This does not add any dependencies and makes this simpler to use for a specific package. The package names are derived from the directory names that compile_commands.json files are found it which is something already done in this script on line 116.

This will make my use case of this much simpler if I select the packages to run this over.

Context

This package's REAMDE contains an example of why I want this feature: https://github.com/tylerjw/moveit_ci_tools

Comment on lines +98 to +101
if len(args.packages_select) == 1:
args.packages_select = args.packages_select[0].strip().split()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the point of these lines is that if someone has a newline-separated string of package names that they would like to use with this argument it will be handled nicely. An example of a command that generates a newline-separated list of packages is colcon list --names-only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because if someone passes a newline-separated escaped string of package names it will be a one length list with the string.

Copy link
Member

@mm318 mm318 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also please update the doc? Thanks!

ament_clang_tidy/ament_clang_tidy/main.py Outdated Show resolved Hide resolved
ament_clang_tidy/ament_clang_tidy/main.py Show resolved Hide resolved
@mm318 mm318 self-assigned this Jan 19, 2021
@tylerjw tylerjw changed the title Add --packages-select argument to ament_clang_tidy Add --packages-select and --clang-tidy-version argument to ament_clang_tidy Jan 19, 2021
Signed-off-by: Tyler Weaver <tylerjw@gmail.com>

Add comment explaining handling quoted list of space separated package names

Update documentation for ament_clang_tidy

Signed-off-by: Tyler Weaver <tylerjw@gmail.com>
if not compilation_dbs:
print('No compilation database files found', file=sys.stderr)
return 1

bin_names = [
# 'clang-tidy',
'clang-tidy-6.0',
'clang-tidy-' + args.clang_tidy_version,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this a separate change. Supporting other versions of clang-tidy requires enhancements to the parsing of errors and warnings. The regex at

error_re = re.compile('(/.*?\\.(?:%s)):(\\d+):(\\d+): (?:warning:|error:)' %
just won't cut it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll split this change out. I should have known better. The reason I did this was that we have standardized on clang-10 tooling for moveit in both ros1 and 2. As far as I can tell this works with clang-tidy-10.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stdout output may be fine, but I think for certain kinds of errors and warning returned by clang-tidy-10, the xUnit XML file will contain nonsensical snippets.

Either way, I think adding support for a newer version of clang-tidy needs a closer look.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll split this change out now and do some testing. Maybe I can figure out a straightforward way to support clang-tidy-10. It would make using this much easier as 10 is much newer and therefore more easily available in newer Ubuntu now and in the future (hence why we changed in MoveIt).

@tylerjw tylerjw changed the title Add --packages-select and --clang-tidy-version argument to ament_clang_tidy Add --packages-select to ament_clang_tidy Jan 20, 2021
@mm318
Copy link
Member

mm318 commented Jan 20, 2021

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@mm318 mm318 merged commit 5d835a9 into ament:master Jan 20, 2021
@tylerjw tylerjw deleted the clang_tidy_packages_select branch January 20, 2021 23:24
wjwwood added a commit that referenced this pull request May 3, 2022
Kind of a follow up of #287, as the --packages-select option only makes sense with a combined compile_commands.json which you only get with this mixin, which aggregates them for you there. Otherwise each package would generate its own compile_commands.json file.
wjwwood added a commit that referenced this pull request May 3, 2022
Kind of a follow up of #287, as the --packages-select option only makes sense with a combined compile_commands.json which you only get with this mixin, which aggregates them for you there. Otherwise each package would generate its own compile_commands.json file.

Signed-off-by: William Woodall <william@osrfoundation.org>
wjwwood added a commit that referenced this pull request May 10, 2022
Kind of a follow up of #287, as the --packages-select option only makes sense with a combined compile_commands.json which you only get with this mixin, which aggregates them for you there. Otherwise each package would generate its own compile_commands.json file.

Signed-off-by: William Woodall <william@osrfoundation.org>
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

Successfully merging this pull request may close these issues.

None yet

2 participants