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

ament_lint_auto finds recursive test dependencies causing downstream packages to inherit conflicting linters #461

Open
Ryanf55 opened this issue Nov 22, 2023 · 0 comments

Comments

@Ryanf55
Copy link

Ryanf55 commented Nov 22, 2023

Use case with current behavior

I'm trying to use a different python linter than flake8 because flake8 doesn't automatically correct your files.

ament_black is much better for new projects not in the ROS core because developers don't need to spend time on manual formatting.
https://github.com/botsandus/ament_black

I create a package foo, and I also like using ament_lint_auto to specify all my linter dependencies. I do NOT depend on ament_lint_common because that has flake8, and flake8 doesn't agree with black.

package.xml

  <depend>std_msgs</depend>
  <test_depend>ament_cmake_black</test_depend>
  <test_depend>ament_cmake_copyright</test_depend>
  <test_depend>ament_cmake_lint_cmake</test_depend>
  <test_depend>ament_cmake_pep257</test_depend>
  <test_depend>ament_cmake_pytest</test_depend>
  <test_depend>ament_cmake_uncrustify</test_depend>
  <test_depend>ament_cmake_xmllint</test_depend>
  <test_depend>ament_lint_auto</test_depend>
  
  <export>
    <build_type>ament_cmake</build_type>
  </export>

CMakeLists.txt

if(BUILD_TESTING)
  # Add linters.
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

Great!

Now, run the tests

colcon test --packages-select my_pkg
colcon test-result --all
colcon test-result --all | grep flake8
>>> build/ardupilot_msgs/test_results/ardupilot_msgs/flake8_rosidl_generated_py.xunit.xml: 1 test, 0 errors, 0 failures, 0 skipped

Oh no! flake8 is running, even though my package doesn't have test dependencies on it, nor does it use ament_lint_common!

Environment

  • OS: Ubuntu 22
  • ament installation: ROS 2 humble binaries
  • ament_lint_auto 0.12.8-1jammy.20230919.193849

Desired behavior

I am not forced to use linters I do not put in my package.xml as test_depend.

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

No branches or pull requests

1 participant