[Documentation] [TitleIndex] [WordIndex

  Show EOL distros: 

Package Summary

CMake lint commands for ROS packages. The lint commands perform static checking of Python or C++ source code for errors and standards compliance.

Package Summary

CMake lint commands for ROS packages. The lint commands perform static checking of Python or C++ source code for errors and standards compliance.

desktop: angles | common_tutorials | geometry_tutorials | robot | ros_tutorials | roslint | visualization_tutorials | viz

Package Summary

CMake lint commands for ROS packages. The lint commands perform static checking of Python or C++ source code for errors and standards compliance.

desktop: common_tutorials | geometry_tutorials | robot | ros_tutorials | roslint | visualization_tutorials | viz

Package Summary

CMake lint commands for ROS packages. The lint commands perform static checking of Python or C++ source code for errors and standards compliance.

desktop: angles | common_tutorials | geometry_tutorials | robot | ros_tutorials | roslint | visualization_tutorials | viz

Package Summary

CMake lint commands for ROS packages. The lint commands perform static checking of Python or C++ source code for errors and standards compliance.

desktop: angles | common_tutorials | geometry_tutorials | robot | ros_tutorials | roslint | visualization_tutorials | viz

Package Summary

CMake lint commands for ROS packages. The lint commands perform static checking of Python or C++ source code for errors and standards compliance.

desktop: angles | common_tutorials | geometry_tutorials | joint_state_publisher_gui | robot | ros_tutorials | roslint | urdf_tutorial | visualization_tutorials | viz

Package Summary

CMake lint commands for ROS packages. The lint commands perform static checking of Python or C++ source code for errors and standards compliance.

desktop: angles | common_tutorials | geometry_tutorials | joint_state_publisher_gui | robot | ros_tutorials | roslint | urdf_tutorial | visualization_tutorials | viz

Package Summary

CMake lint commands for ROS packages. The lint commands perform static checking of Python or C++ source code for errors and standards compliance.

You might also check catkin_lint for checking package configuration.

Usage

Add a build dependency on roslint to your package's package.xml:

<build_depend>roslint</build_depend>

In your package's CMakeLists.txt file, include roslint as one of your catkin component dependencies:

find_package(catkin REQUIRED COMPONENTS roslint ...)

Then, invoke the roslint functions from your CMakeLists.txt, eg:

roslint_cpp()

If you'd like more control over what gets linted, you can specify the exact files:

roslint_cpp(src/foo.cpp src/bar.cpp src/baz.cpp)

To run roslint against your package you must invoke catkin_make with your package's roslint target. For example, for a package named my_fancy_package you would run:

catkin_make roslint_my_fancy_package

To use roslint with catkin_tools (aka catkin build), use the following command:

catkin build my_fancy_package --make-args roslint

You can also manually invoke roslint from the build directory with the follow commands:

cd ~/catkin_ws
catkin build
cd build/my_fancy_package
make roslint

See the following section for all available functions.

Reference

Each roslint_* function create a catkin build target called roslint_''pkgname'', which runs all specified lint operations for the package. Each additionally creates (if it does not yet exist) a master roslint target, which depends on all other roslint_* targets.

Each function can be called multiple times, if that's more convenient.

Tips

To fix basic whitespace issues in C++, try using astyle. Example invocation within your package:

sudo apt-get install astyle
find -regextype egrep -regex '.*\.[ch](pp)?$' -exec astyle '{}' --style=allman --indent=spaces=2 --pad-oper --unpad-paren --pad-header --convert-tabs \;

For similar fixes in Python, try pep8ify. Example:

sudo pip install pep8ify
pep8ify -nw .

When using automated tools to manipulate source code, it's best to push changes made by the tool as their own commit, distinct from any manual changes made afterward. Since an automated change can be large and difficult to review, this ensures that everyone can reproduce the change locally, including on other branches if necessary for a merge.

Should you have the need to disable specific warnings, the linter filter can be modified. You will need to update your CMakeLists.txt. Example:

set(ROSLINT_CPP_OPTS "--filter=-runtime/references,-runtime/int")
roslint_cpp()
set(ROSLINT_PYTHON_OPTS "--max-line-length=180")
roslint_python()

You can also disable cpplint for a particular line only:

// There's just no other way; I don't control the location of this header.
#include "my_silly_header.h"  // NOLINT(build/include)


2022-05-28 12:58