Skip to content

[ament_clang_tidy] exclude rclcpp_components/node_main_* files - #583

Open
mqcmd196 wants to merge 1 commit into
ament:rollingfrom
mqcmd196:exclude-components-generated
Open

mqcmd196 wants to merge 1 commit into
ament:rollingfrom
mqcmd196:exclude-components-generated

Conversation

@mqcmd196

@mqcmd196 mqcmd196 commented Jun 1, 2026

Copy link
Copy Markdown

Now ament_clang_tidy tests rclcpp_components generated file. It failes like

build/g1_hardware/Testing/20260601-0158/Test.xml: 6 tests, 0 errors, 1 failure, 0 skipped
- clang_tidy
  <<< failure message
    -- run_test.py: invoking following command in '/home/obinata/ros/colcon_ws/src/g1_ros/g1_hardware':
     - /opt/ros/jazzy/bin/ament_clang_tidy --xunit-file /home/obinata/ros/colcon_ws/build/g1_hardware/test_results/g1_hardware/clang_tidy.xunit.xml /home/obinata/ros/colcon_ws/build/g1_hardware --config .clang-tidy
    found compilation database for package 'g1_hardware' at '/home/obinata/ros/colcon_ws/build/g1_hardware/compile_commands.json'
    /home/obinata/ros/colcon_ws/build/g1_hardware/rclcpp_components/node_main_loco_cmd_adapter_node.cpp:27:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace]
       27 | using namespace rclcpp::executors;
          | ^
    /home/obinata/ros/colcon_ws/build/g1_hardware/rclcpp_components/node_main_loco_cmd_adapter_node.cpp:28:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace]
       28 | using namespace rclcpp::experimental::executors;
          | ^

    -- run_test.py: return code 0
    -- run_test.py: verify result file '/home/obinata/ros/colcon_ws/build/g1_hardware/test_results/g1_hardware/clang_tidy.xunit.xml'
  >>>
build/g1_hardware/test_results/g1_hardware/clang_tidy.xunit.xml: 5 tests, 0 errors, 2 failures, 0 skipped
- g1_hardware.clang_tidy /home/obinata/ros/colcon_ws/build/g1_hardware/rclcpp_components/node_main_loco_cmd_adapter_node.cpp:27:1
  <<< failure message
    do not use namespace using-directives; use using-declarations instead [google-build-using-namespace]
  >>>
- g1_hardware.clang_tidy /home/obinata/ros/colcon_ws/build/g1_hardware/rclcpp_components/node_main_loco_cmd_adapter_node.cpp:28:1
  <<< failure message
    do not use namespace using-directives; use using-declarations instead [google-build-using-namespace]
  >>>

This PR fixes it

Signed-off-by: Yoshiki Obinata <mqcmd196@hotmail.co.jp>
@mqcmd196

mqcmd196 commented Jun 1, 2026

Copy link
Copy Markdown
Author

I hope this patch will be backported to jazzy

@skyegalaxy

Copy link
Copy Markdown

the template should be updated in rclcpp_components.

@mqcmd196

mqcmd196 commented Jun 5, 2026

Copy link
Copy Markdown
Author

@skyegalaxy Since clang-tidy may use the user's config, the results of the tests on the generated component code could vary depending on that. Therefore, I think it would be better to exclude it here.

@mqcmd196

mqcmd196 commented Jun 8, 2026

Copy link
Copy Markdown
Author

Maintainers, could you review it?

@mqcmd196

Copy link
Copy Markdown
Author

ping @ahcorde

@skyegalaxy

Copy link
Copy Markdown

Thanks for raising the contribution, but we should either update clang tidy configuration or fix the actual linting issue this surfaces instead of just blanket excluding rclcpp components.

@mqcmd196

Copy link
Copy Markdown
Author

@skyegalaxy @asymingt As the patch for fixing rclcpp side was rejected, could you reopen this PR?

@mqcmd196

Copy link
Copy Markdown
Author

I think it's inappropriate to require users to write lint configurations while having to take into account automatically generated programs.

@asymingt asymingt reopened this Jun 28, 2026
@mergify

mergify Bot commented Jun 28, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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

Successfully merging this pull request may close these issues.

4 participants