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

Not all static analyzers are run for all packages #57

Open
Ronoman opened this issue Aug 9, 2022 · 4 comments
Open

Not all static analyzers are run for all packages #57

Ronoman opened this issue Aug 9, 2022 · 4 comments

Comments

@Ronoman
Copy link

Ronoman commented Aug 9, 2022

If I'm not mistaken (which is quite possible, new to ROS2), the only tests run for a package under colcon test are ones that are listed in that package's package.xml within <test_depend>package_name</test_depend> tags. Some ROS2 packages (take rcutils for example) test_depend on ament_lint_common, which in turn depend on all of our static analyzers (ament_clang_tidy, ament_copyright, ament_cobra, ament_cppcheck, etc). However, other packages (take tf2 for example) only depend on a subset of these analyzers, so they are not all run.

I'm not sure what the best way to resolve this is. There are two things I can think of:

  1. If the only place to indicate test dependencies is in a packages package.xml (which I believe is the case, but again could be wrong), insert <test_depend> tags during docker build, or when another common command is triggered (colcon build, colcon test, entrypoint.sh for the docker image, or maybe an explicit command run by the user).
  2. Upstream the <test_depend> to all of the ROS packages we want to run our static analysis tools on, either to the main ROS2 branches, or to spaceros branches.

Option 1 feels wrong to me, and option 2 feels overbearing.

@nuclearsandwich
Copy link

The Space ROS project has been doing currently relies on the fact that many ROS 2 core packages rely on a metapackage called ament_lint_common, which is for the "common" set of linters and static analysis tools used by ROS 2 core packages, and patching ament_lint_common in Space ROS to include additional static analysis tools (or their ament / ament_cmake wrappers). Here's the current list of "common" linters from ament_lint's spaceros branch.

This has the advantage of being relatively low touch and only requiring changes in one repository but the disadvantages are that it relies on all packages being considered for static analysis depending on ament_lint_common rather than an explicit list of analysis tools. Since the listed linters are expressed as dependencies that means that changing the list must be something happens in source at build time rather than during some later operation, especially since the CMake hooks which add tool runs to the test processes need to be updated when changing these dependencies.

I'm just getting back from extended vacation but somewhere I've got the start of a proposal to try and decouple the build-time dependencies from the test-time static analysis runs. However doing so isn't trivial and there are several considerations and trade-offs with moving to that approach. I'll try to get that proposal resurrected and share it for feedback both within the ROS team and Space ROS itself.

@mjeronimo mjeronimo removed their assignment May 16, 2023
@ivanperez-keera
Copy link

We'll revisit which static analyzers are executed for each package. However, this issue has no action item or taker attached to it, and it's too big to be addressed. I'm closing this and we'll revisit in the future.

Thanks a lot, @Ronoman 😄

@ivanperez-keera ivanperez-keera closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2024
@Bckempa Bckempa reopened this Mar 7, 2024
@Bckempa
Copy link

Bckempa commented Mar 7, 2024

Reopened to cover @xfiderek's work demoed at the Space ROS Technical Meeting

@Bckempa Bckempa added this to the humble-2024.04.0 milestone Mar 7, 2024
xfiderek added a commit to xfiderek/ament_lint that referenced this issue Mar 13, 2024
…).

Signed-off-by: xfiderek <fiderekblazejgmail.com>
xfiderek added a commit to xfiderek/space-ros that referenced this issue Mar 13, 2024
xfiderek added a commit to xfiderek/space-ros that referenced this issue Mar 13, 2024
xfiderek added a commit to xfiderek/ament_lint that referenced this issue Mar 13, 2024
…).

Signed-off-by: xfiderek <fiderekblazejgmail.com>
Signed-off-by: xfiderek <fiderekblazej@gmail.com>
xfiderek added a commit to xfiderek/ament_lint that referenced this issue Mar 13, 2024
…).

Signed-off-by: xfiderek <fiderekblazej@gmail.com>
xfiderek added a commit to xfiderek/spaceros-docker that referenced this issue Mar 13, 2024
@xfiderek
Copy link

xfiderek commented Mar 13, 2024

PRs raised. they need to be merged in the following order:
ament_lint - ament/ament_lint#482
spaceros - #145
docker - space-ros/docker#141

Check PR in spaceros repo for conceptual overview and gist of implementation

xfiderek added a commit to xfiderek/space-ros that referenced this issue Mar 13, 2024
xfiderek added a commit to xfiderek/ament_lint that referenced this issue May 22, 2024
xfiderek added a commit to xfiderek/ament_lint that referenced this issue May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

No branches or pull requests

7 participants