fkie/catkin_lint

Check for violations of 'CMake coding standards'?

Closed this issue · 5 comments

I'm not sure, but I haven't seen catkin_lint complain about any 'violations' of the CMake coding standards.

catkin_lint -W2 my_pkg doesn't report the following for instance:

..
foreach(foo bar boo)
  ..
endforeach(foo)
..

Would it be possible to add this?

The "Closing keyword should have empty parenthesis" condition is very easy to check, I will add it later. Other coding standards are more difficult in the current implementation (e.g. indentation is already stripped and keywords made lower-case in the parsing stage). Some even need a much more sophisticated flow analysis (e.g. is this variable actually a string, a path, or a bool value).

catkin_lint does check for proper usage of catkin_package(), ${PROJECT_NAME} (strictly speaking, it checks for the project name being part of certain targets and global variables), the REQUIRED keyword in find_package(catkin), and warns about exporting pkg-config results in catkin_package().

Just tested v1.3.2, thanks for the additions so far.

I like this tool very much, thanks for your efforts.

  • Call catkin_package before any targets
  • Use ${PROJECT_NAME} wherever possible
  • find_package(... REQUIRED)
  • Avoid Pkg_config
  • Keep lists sorted
  • Lowercase keywords
  • Uppercase arguments
    (Sort of implemented; lower-case argument keywords are not recognized as such, neither by catkin_lint nor by CMake itself)
  • Closing keyword should have empty parenthesis
  • Indentation
  • Variable names
  • Forbidden variables
  • Conditions and Variables

Less than two years :-)

:). Nice!

Thanks for all your work on catkin_lint 👍, much appreciated.