ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

roslint python errors to stdout?

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

lucasw gravatar image

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

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
2

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

Rufus gravatar image

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

set(ROSLINT_PYTHON_OPTS "1>&2")
roslint_python()
edit flag offensive delete link more

Comments

That works, but it seems like there ought to be a standard option to do that, I looked at the roslint pycodestyle.py 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 -0600 )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 -0600 )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 -0600 )edit

Question Tools

2 followers

Stats

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

Seen: 339 times

Last updated: Mar 01 '21