You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Correct: lints all files in src
ament_cpplint src
# Bug: lints all files in current directory (possibly still excluding some things, I didn't verify that)
ament_cpplint --exclude "some/path.cpp" src
# Correct: workaround that does lint all files in src, excluding the path
ament_cpplint --exclude "some/path.cpp" -- src
I assume the way argparse is used to define 'exclude' is defaulting the 'paths' to '.'
I wouldn't be surprised if similar problems exist for other linters.
Only tested this on Iron.
The text was updated successfully, but these errors were encountered:
Hi, @robin-zealrobotics. That is not a bug, but rather a specific of the Python's args parser and how it parsers positional arguments.
There is no way to distinguish positional argument in this concrete case src from the list entity if it goes right after the explicit list entity. The known workaround is only, as you mentioned, to put the -- separator before the positional argument.
To mitigate this issue, the explicit "paths" argument could be added in addition to the existent positional "paths" argument defined here
help='The files or directories to check. For directories files ending '
'in %s will be considered.'%
', '.join(["'.%s'"%eforeinextensions+headers]))
# not using a file handle directly
# in order to prevent leaving an empty file when something fails early
We can't just simply change the positional argument "paths" to be a non-explicit argument since it will break backward compatibility.
Also, the documentation could be updated to point out that a workaround with a -- separator should be used when a positional argument needs to be used after the list.
However, help is needed with all of these proposals to be implemented.
I assume the way argparse is used to define 'exclude' is defaulting the 'paths' to '.'
I wouldn't be surprised if similar problems exist for other linters.
Only tested this on Iron.
The text was updated successfully, but these errors were encountered: