rosidl_generator_py: linters are exec_depends although generated-code lint tests are opt-in

未关闭
#281 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cmake, python
领域
build-system

调研方向

Start by comparing the linter dependency declarations in rosidl_generator_py/package.xml with the opt-in linter block in rosidl_generator_c, then read rosidl_generator_py_generate_interfaces.cmake and the ADD_LINTER_TESTS documentation. The proposal is to move the five linters to test dependencies and add an actionable configure error naming the required dependency. Done means opt-in users get that guidance and ordinary installs no longer pull in the linters.

由索引模型根据 Issue 内容生成。

描述

rosidl_generator_py/package.xml has five linter packages as <exec_depend>: ament_cmake_cpplint, ament_cmake_flake8, ament_cmake_mypy, ament_cmake_pep257 and ament_cmake_uncrustify on rolling (ament_cmake_cppcheck in place of ament_cmake_mypy on jazzy). They were added in #199 to fix #198. A package that passed ADD_LINTER_TESTS to rosidl_generate_interfaces() failed to configure because it did not depend on ament_cmake_flake8 itself. The comment in package.xml already notes they are only needed by downstream tests.

rosidl_core_runtime has rosidl_generator_py as a build_export_depend, so every binary install that contains a message package also installs the five linters and what they pull in. A deployment that never builds message packages never uses them. (We currently repack rosidl_generator_py without them for our production environment.)

rosidl_generator_c has the same opt-in block (if(BUILD_TESTING AND rosidl_generate_interfaces_ADD_LINTER_TESTS) followed by find_package(ament_cmake_cpplint REQUIRED)), but no linter exec_depend. A package that opts in there declares the linters as its own test dependencies.

Proposal

Handle rosidl_generator_py the way rosidl_generator_c does:

  1. Move the five linters from <exec_depend> to <test_depend>.
  2. In rosidl_generator_py_generate_interfaces.cmake, keep find_package(... REQUIRED) but add a clear configure error naming the <test_depend> to add, so the #198 case fails with an actionable message.
  3. Mention in the ADD_LINTER_TESTS documentation that the calling package must test_depend on the linters (or ament_lint_common).

ADD_LINTER_TESTS is off by default, so only packages that opt in are affected. If maintainers prefer to keep the dependencies until a test_export_depend exists, an alternative is find_package(... QUIET) with a warning that skips the generated-code lint tests when a linter is missing.

I can open a PR if this direction is acceptable.

主要语言
EmberScript
星标
26
派生
75
平均合并
6 天 7 小时
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ros2/rosidl_python 的其他 Issue

查看 ros2/rosidl_python 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

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