ament / ament/ament_lint

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

未关闭
#461 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
50
派生
129
平均合并
3 天 10 小时
30 天内合并 PR
3

描述

## 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**
```xml
std_msgs
ament_cmake_black
ament_cmake_copyright
ament_cmake_lint_cmake
ament_cmake_pep257
ament_cmake_pytest
ament_cmake_uncrustify
ament_cmake_xmllint
ament_lint_auto


ament_cmake

```
**CMakeLists.txt**
```cmake
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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。