Ask Your Question
0

how to make ros cpplint use a relative path for header guard check

asked 2018-03-14 13:35:22 -0500

dennis.bergin gravatar image

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?

edit retag flag offensive close merge delete

Comments

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?

William gravatar image William  ( 2018-03-14 15:21:28 -0500 )edit

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

dennis.bergin gravatar image dennis.bergin  ( 2018-03-17 10:13:16 -0500 )edit

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]

dennis.bergin gravatar image dennis.bergin  ( 2018-03-17 10:16:53 -0500 )edit

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"

dennis.bergin gravatar image dennis.bergin  ( 2018-03-17 10:19:31 -0500 )edit

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

dennis.bergin gravatar image dennis.bergin  ( 2018-03-17 10:21:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-03-17 17:52:17 -0500

Dirk Thomas gravatar image

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/p... ). 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.

edit flag offensive delete link more

Comments

Thank you for the information. I updated my version of ament. The problem has been alleviated.

dennis.bergin gravatar image dennis.bergin  ( 2018-03-24 13:14:42 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-14 13:35:22 -0500

Seen: 454 times

Last updated: Mar 17 '18