Updated cpplint and cppcheck to exclude directories and files#234
Updated cpplint and cppcheck to exclude directories and files#234ahcorde merged 6 commits intoament:masterfrom
Conversation
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
There is no need for two separate arguments for files and directories. Also the excluded items should be configurable in CMake when using the automatic linting (by setting a global variable) where the package doesn't involve the CMake directly and can't pass a parameter. See other linters for reference. |
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
I added language configuration to the global variables too for uncrustify and cppcheck. But I will open a PR when this is merged |
|
Right now can be used: set(ament_cmake_cppcheck_ADDITIONAL_EXCLUDE "include/tf2/LinearMath/*")
set(ament_cmake_cpplint_ADDITIONAL_EXCLUDE_DIRS include/tf2/LinearMath/)
set(ament_cmake_uncrustify_ADDITIONAL_ARGS --exclude LinearMath)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()The other PR will alllow: set(ament_cmake_cppcheck_ADDITIONAL_LANGUAGE c++)
set(ament_cmake_uncrustify_ADDITIONAL_LANGUAGE "C++") |
Signed-off-by: ahcorde <ahcorde@gmail.com>
bcd5729 to
2c1c73c
Compare
dirk-thomas
left a comment
There was a problem hiding this comment.
The options / arguments / variables seem inconsistent. Do they support only directories or also files? If both, then don't use either one in the naming.
Signed-off-by: ahcorde <ahcorde@gmail.com>
In other API |
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
@dirk-thomas I allowed to exclude files too. |
|
The file |
Signed-off-by: ahcorde <ahcorde@gmail.com>
|
Restored |
dirk-thomas
left a comment
There was a problem hiding this comment.
LGTM with passing CI.
| for include_dir in (args.include_dirs or []): | ||
| cmd.extend(['-I', include_dir]) | ||
| for exclude in (args.exclude or []): | ||
| cmd.extend(['--suppress=*:', exclude]) |
There was a problem hiding this comment.
This code is wrong. This is effectively cppcheck ... --suppress=*: <exclude> ..., which appends <exclude> to the list of files to check but then ignores all checks on all files.
What you were looking for was actually cppcheck ... --suppress=*:<exclude> ... (without the space before <exclude>).
As we discussed in this PR ros2/geometry2#258 (comment), it makes sense to exclude from cppcheck or cpplint some of the files or directories in a package.
We can use these arguments:
Signed-off-by: ahcorde ahcorde@gmail.com