ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Lint target?

asked 2013-08-28 05:30:26 -0600

I've created a sensor driver package, and I've added a linter target to it, but it's pretty manual:

FILE(GLOB LINT_SRCS src/*.cpp include/${PROJECT_NAME}/*.h)
  COMMAND cpplint --filter=-whitespace/line_length ${LINT_SRCS})

Moreover, the resulting target is "um6_cpplint", whereas the ideal thing would be to have a generic run_lint target which works across every package in a workspace, much like run_tests and all do.

I'm picturing that there could be a roslint package which one would you could add to a package's find_package call. Having done so, it would expose a new macro like add_lint_target(); this could call through to cpplint or pylint (or whatever), with the appropriate configuration for ROS style standards.

Down the road, such a package might also include a package linter, which could warn about incomplete package.xml or gotchas present in CMakeLists, complain about things being in the wrong places, lack of install() macros, etc.

Anyhow, does this seem like something which would be useful? Do any pieces of it exist already?

edit retag flag offensive close merge delete


Why not make the linting part of your automated tests?

William gravatar image William  ( 2013-08-28 07:27:15 -0600 )edit

It is part of the travis tests already; part of why it would be nice to have a cross-package target would be so that the test script could just be to "catkin_make all run_tests run_lint", rather than needing to include a package-specific target.

mikepurvis gravatar image mikepurvis  ( 2013-08-28 07:49:50 -0600 )edit

No I mean why not define the lint process in one of your tests, such that `make run_tests` invokes cppcheck (or w/e) and checks the result.

William gravatar image William  ( 2013-08-28 07:53:49 -0600 )edit
William gravatar image William  ( 2013-08-28 07:54:21 -0600 )edit

Gotcha. That's helpful to see an example of another package doing something similar.

mikepurvis gravatar image mikepurvis  ( 2013-08-28 10:05:55 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-28 05:38:43 -0600

joq gravatar image

Seems reasonable to me.

I'd suggest starting a discussion on the ros-sig-buildsystem mailing list to work out the details.

edit flag offensive delete link more



For future viewers:

mikepurvis gravatar image mikepurvis  ( 2013-09-20 07:43:12 -0600 )edit

Question Tools


Asked: 2013-08-28 05:30:26 -0600

Seen: 639 times

Last updated: Aug 28 '13