Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I use ament_cpplint with cpplint plugins for various IDEs?

I am working with C++ code with ROS2. ROS2 has code style standards and one of the recommended linters is ament_cpplint, which is slightly different from cpplint

Most IDEs/Editors for C++ (Clion, Atom, VS Code, Sublime Text) have plugins for cpplint which will run periodic linter checks as you are editing files. You usually have to set the path to the cpplint executable on your computer. I've tried to set the path to ament_cpplint executable instead but it just won't work. I've tried this with multiple IDEs and plugins by now and none of them will work.

I am not sure what's causing this, Google's cpplint works with IDEs. And I can run $ ament_cpplint from the command line just fine, but I can't get it to work in an IDE.

like image 502
ICRed Avatar asked Nov 23 '25 10:11

ICRed


1 Answers

This might be too late for you, but for others.

You need to pass the path to the cpplint.py executable that is inside the ament_cpplint package.

For ros2 galactic, it is located here:
/opt/ros/galactic/lib/python3.8/site-packages/ament_cpplint/cpplint.py

like image 173
ejalaa12 Avatar answered Nov 25 '25 00:11

ejalaa12