ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
For ROS 1, I think roslint
is the best option out there.
I'll just link to the documentation here: https://wiki.ros.org/roslint
There are quite a few linters for ROS 2, but for easy integration they require the use of ament_cmake
:
It essentially boils down to depending on certain packages (e.g. ament_lint_common
and ament_lint_auto
) and then making a cmake macro call to register some new tests for the default linters (i.e. ament_lint_auto_find_test_dependencies()
) or manually setting up each linter you want (if you don't want the default list).
Right now (October 2018), the default linters in ROS 2 are:
Each one will try to find the appropriate files to lint and lint them automatically (e.g. cppcheck only checks c++ files and flake8 only looks at python files) as an automated test.
Each one (I think they all do anyways) also has a command line tool, e.g.:
ament_uncrustify .
will run uncrustify (with our config) over all cpp files under the current directorySome have automatic reformatting too:
ament_uncrustify . --reformat
will also fix the identified violations automaticallySome have a little bit of documentation, but it's limited, e.g.:
All the core ROS 2 packages run these linters.
There was also a discussion about how to adjust either the ROS 1 or ROS 2 style guides (or both) to make them compatible with one another:
If we could finish pushing on that it might be possible to eventually use the ROS 2 linters in ROS 1, but as of now that's not possible in any standard way.