ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

roslint python errors to stdout?

asked 2019-10-17 11:53:28 -0500

lucasw gravatar image

updated 2021-03-01 09:50:38 -0500

I'm running roslint within travis like this:

catkin build $(catkin list --depends-on roslint -u) --no-deps --catkin-make-args roslint

When there is a lint error in C++ it is visible in stdout and is easy to read, but python errors are in a log file like this:

Errors     << foo_pkg:make /home/lucasw/catkin_ws/logs/foo_pkg/build.make.472.log

Adding --verbose works but there is a ton of other output also obscuring the actual error- is there a way to just get the python lint error?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-03-01 00:09:38 -0500

Rufus gravatar image

You can do so by making pep8 redirect stdout to stderr with the following in your CMakeLists.txt

edit flag offensive delete link more


That works, but it seems like there ought to be a standard option to do that, I looked at the roslint source and tried out some options but they didn't have any effect when deliberately introducing pep8 violations:

set(ROSLINT_PYTHON_OPTS "--show-source")
set(ROSLINT_PYTHON_OPTS "--show-pep8")
set(ROSLINT_PYTHON_OPTS "--verbose")

or in combination

set(ROSLINT_PYTHON_OPTS "--show-source" "--show-pep8")
lucasw gravatar image lucasw  ( 2021-03-01 09:45:40 -0500 )edit

I think the key is to have outputs print to stderr which is what cpplint does. However, there doesn't seem to be any option to have pep8 output to stderr.

Rufus gravatar image Rufus  ( 2021-03-01 20:49:46 -0500 )edit

Example of disabling all the default ignores (E121,E123,E126,E226,E24,E704,W503,W504):

set(ROSLINT_PYTHON_OPTS "--ignore=''" "1>&2")
lucasw gravatar image lucasw  ( 2021-09-08 10:55:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-10-17 11:53:28 -0500

Seen: 222 times

Last updated: Mar 01 '21