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

Aberta
#281 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
55/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
cmake, python
Domínio
build-system

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
EmberScript
Estrelas
26
Forks
75
Merge médio
6d 7h
PRs com merge (30d)
5

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de ros2/rosidl_python

Todas as issues de ros2/rosidl_python

Issues semelhantes

Mais issues de Build System

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.