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 clang tidy to ament linters #155

Merged
merged 14 commits into from
Jul 24, 2019
Merged

Add clang tidy to ament linters #155

merged 14 commits into from
Jul 24, 2019

Conversation

JShep1
Copy link
Contributor

@JShep1 JShep1 commented Jul 19, 2019

Adds ament_clang_tidy functionality to ament with default Google configuration checks enabled.

JShep1 added 12 commits July 19, 2019 15:47
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
@JShep1 JShep1 requested a review from dirk-thomas July 19, 2019 23:03
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

A bunch of small things to consider.

ament_clang_tidy/ament_clang_tidy/main.py Outdated Show resolved Hide resolved

bin_names = [
'clang-tidy',
'clang-tidy-6.0',
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to add clang-tidy-3.8 here, as that is the version on Xenial.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the version from Xenial relevant here? Our current target platform is Bionic which ships 6.0.

Copy link
Contributor

Choose a reason for hiding this comment

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

For ROS 2, yes. For another project that we are considering using this on, they still target Xenial. The other linters also generally support older versions, so it seems like we should follow that trend.

Copy link
Contributor

@dirk-thomas dirk-thomas Jul 23, 2019

Choose a reason for hiding this comment

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

I would expect significant differences between version 6.0 and 3.8. So I am not sure if supporting such wide spread is feasible.

The other linters also generally support older versions, so it seems like we should follow that trend.

That is not really an argument that we haven't taken the time to update other places...

return


def find_executable(file_names):
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm. The duplication of find_executables, get_files, get_xunit_content, etc. with other ament linters is pretty unfortunate. However, I see that is how we have done it for all of the linters, and I think it deserves a different patch. I'll request that you open an issue to investigate how to share more code between them.

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 was thinking the same thing implementing this section - I'll open the issue shortly

Copy link
Contributor

Choose a reason for hiding this comment

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

#157 is the new issue.

ament_clang_tidy/doc/index.rst Outdated Show resolved Hide resolved
ament_clang_tidy/doc/index.rst Outdated Show resolved Hide resolved
ament_clang_tidy/package.xml Show resolved Hide resolved
ament_clang_tidy/package.xml Outdated Show resolved Hide resolved
Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
@JShep1 JShep1 requested a review from clalancette July 23, 2019 23:20
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

One nit, and one comment. I'll approve, but please update the @osrfoundation.org email addresses before merging.

ament_clang_tidy/setup.py Outdated Show resolved Hide resolved
return


def find_executable(file_names):
Copy link
Contributor

Choose a reason for hiding this comment

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

#157 is the new issue.

Signed-off-by: John Shepherd <johnshepherd96@yahoo.com>
@JShep1 JShep1 merged commit 682035c into master Jul 24, 2019
@delete-merged-branch delete-merged-branch bot deleted the jshep1/add_clang_tidy branch July 24, 2019 16:04

include("${ament_cmake_clang_tidy_DIR}/ament_clang_tidy.cmake")

ament_register_extension("ament_lint_auto" "ament_cmake_clang_tidy"
Copy link
Contributor

@hidmic hidmic Jul 30, 2019

Choose a reason for hiding this comment

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

@JShep1 @clalancette this is unfortunate as it may prevent us from backporting without breaking havoc on packages that already rely on ament_lint_auto :(

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a strong reason to have it hooked up? If not, and @dirk-thomas agrees, I'd say we remove it to preclude any issues once the patch release is out.

Copy link
Contributor

Choose a reason for hiding this comment

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

A package must be find_package()-ing this in order to trigger the extension being registered. So I don't see how this change would be a problem - even with ament_lint_auto since no package depends on this new package yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

A package must be find_package()-ing this in order to trigger the extension being registered.

I see it commented out in ament_lint_common, yes.

So I don't see how this change would be a problem - even with ament_lint_auto since no package depends on this new package yet.

That's true of our packages. Could it ever be a problem if downstream packages start depending on it? If that's too far fetched, then I withdraw my concerns and suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

If packages start depending on it they probably intend to use it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Argh, I wrote half of it. I meant to say that it may be a problem if downstream packages start depending on it while building core packages that depend on ament_lint_auto from source.

Copy link
Contributor

Choose a reason for hiding this comment

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

How would that effect downstream packages in any way?

Copy link
Contributor

@hidmic hidmic Jul 30, 2019

Choose a reason for hiding this comment

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

A package must be find_package()-ing this in order to trigger the extension being registered.

If a downstream package depends on this linter, it'll get registered as an ament_lint_auto extension. If it gets registered as an ament_lint_auto extension, it'll get hooked up as a linter for packages that depend on ament_lint_auto. That is the case for core packages as well. Causing lint failures if building those from source. Or at least that's my train of thought.

Copy link
Contributor

Choose a reason for hiding this comment

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

No package I am aware of declares a linter package as an exported dependency. They are usually only test dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright, not a problem then :)

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.

4 participants