-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trouble with ament_cmake_*_ADDITIONAL_EXCLUDE
#366
Comments
@jtbandes the linters only exclude files if they're provided with relative/absolute paths to the files or with wildcard expressions that expand to the relative/absolute paths to the files. I'm not sure which linters do the latter, but I implemented it for copyright and uncrustify (#326). Having said that, this worked for me in ros2/geometry2#469: set(
_linter_excludes
include/tf2/LinearMath/Matrix3x3.h
include/tf2/LinearMath/MinMax.h
include/tf2/LinearMath/QuadWord.h
include/tf2/LinearMath/Quaternion.h
include/tf2/LinearMath/Scalar.h
include/tf2/LinearMath/Transform.h
include/tf2/LinearMath/Vector3.h
)
ament_copyright(EXCLUDE ${_linter_excludes})
ament_cppcheck(
EXCLUDE ${_linter_excludes}
LANGUAGE c++
)
ament_cpplint(EXCLUDE ${_linter_excludes})
ament_lint_cmake()
ament_uncrustify(
EXCLUDE ${_linter_excludes}
LANGUAGE c++
) This exclusion behavior ought to be documented better. Feel free to open a PR about how to exclude files if you have time! |
Hmm, thanks for the ideas. I tried this: find_package(ament_cmake_cppcheck REQUIRED)
list(APPEND AMENT_LINT_AUTO_EXCLUDE
ament_cmake_uncrustify
ament_cmake_copyright
ament_cmake_cpplint
ament_cmake_cppcheck
)
file(GLOB_RECURSE _linter_excludes ${PROJECT_SOURCE_DIR}/vendor *)
ament_cppcheck(EXCLUDE ${_linter_excludes}) But for some reason seems to put most of the files before
Any idea why? Am I misusing the EXCLUDE param? |
Thanks for the tips. I was able to work around the issue by manually passing a file list to each linter command: ros-tooling/rosbag2_storage_mcap@03bd8c0 |
In this PR, I'm adding a
vendor
folder that contains some git submodules. I want to prevent the ament_lint_auto linters from running on the code undervendor
, since we don't control that code.While #343 would be an ideal solution for me, since it is still open, I have been looking for ways to disable individual linters for the
vendor
directory. I found that some of them have variables to set exclude paths, so I tried this:(I also tried relative paths without the
${PROJECT_SOURCE_DIR}
)However I still get lint errors on files in the vendor directory. For example:
Does anyone have advice on what I might be doing wrong? Is there a way to correctly exclude these files?
The text was updated successfully, but these errors were encountered: