0
$\begingroup$

Rosanswers logo

Is there a way to force the ccpplint used by ros2 in ament to use a relative path starting at ros2_overylay_ws/src instead of the explicit full path when checking header guards?


Originally posted by dennis.bergin on ROS Answers with karma: 1 on 2018-03-14

Post score: 0


Original comments

Comment by William on 2018-03-14:
Can you edit your question to also describe your folder layout exactly (maybe use the output of tree) and the exact command you're running and what folder it is in? Have you tried manually setting the --root option?

Comment by dennis.bergin on 2018-03-17:
I am using the command ament test . I am not sure how to add the --root option. A portion of my directory structure is as follows: project location: /home/dennis/Projects/ros2_overlay_ws/src/small_robot

within small_robot : common/include common/src vms/contoller/include vms/controller/src

Comment by dennis.bergin on 2018-03-17:
the cpplint mesage is as follows: No #ifndef header guard found, suggested CPP variable is: _HOME__DENNIS__PROJECTS__ROS2_OVERLAY_WS__SRC__SMALL_ROBOT__VMS__COMMON__INCLUDE__VMS_COMMON__ATTRIBUTE_HPP [build/header_guard] [5]

Comment by dennis.bergin on 2018-03-17:
The header guard for his file is #ifndef _SMALL_ROBOT__VMS__COMMON__ATTRIBUTE_HPP I do not want to include the user specifc path portio "/home/dennis/projects/ros2_overlay_ws/src"

Comment by dennis.bergin on 2018-03-17:
lastly, sorry if my explanatio is confusing. I showed two example directory structures. the directory structure for the specific error message I provided is small_robot/vms/common/attribute.h within /home/dennis/Projects/ros2_overlay_ws/src

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The ament_cpplint has two ways to detect the root for your source code:

  1. It determines the --root by looking for known names in the path hierarchy, namely include, src, test. If you are using the latest release of ROS 2 (Ardent) this will likely not work for you. There was recently a fix for this logic (see https://github.com/ament/ament_lint/pull/94). You might want to consider to use a newer version of this package from source to make this work for your use case.

  2. It also looks for the root of a git repository in case your code is using that. I guess that is not the case for you though.


Originally posted by Dirk Thomas with karma: 16276 on 2018-03-17

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by dennis.bergin on 2018-03-24:
Thank you for the information. I updated my version of ament. The problem has been alleviated.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.