-
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
EXCLUDE argument inconsistency #354
Comments
I have the latest Rolling with 0.11.4 |
@alsora I have a demo package where both cpplint and uncrustify exclude the file correctly if I spell out the full relative (to the CMakeLists.txt) path, i.e. Can you verify if this is still an issue for you? |
Is it possible to parse a list of exclude paths instead of just one? Or if I put in the root of a folder as the exclude path would the linter exclude everything within that root directory? |
@jclinton830 you can provide a list of exclude paths! Check ros2/geometry2/tf2/CMakeLists.txt#L57-L66 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
)
This should not work, but the |
@aprotyas Thank you! |
@aprotyas If my exclude path is like seen below, would it ignore all the files and folders within that exclude directory?
in ament_cmake_copyright in the cmakelist the You mentioned wildcard expansion above, but when I provide the exclude path like below, it only excludes all the .cc files in that folder and the .cc files inside of the nested folders are not excluded.
My question is, why is set up this way? Its so time consuming to add every file wildcard separately when dealing with a large project. |
@jclinton830 I can't speak for the original motivation throughout Having said that, I would suggest leveraging your build system (or shell) if you're trying to ignore large sub-trees. If you're invoking the linter through CMake, you can obtain a list of files with file(GLOB_RECURSE
_linter_excludes
LIST_DIRECTORIES false
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
extern/googletest/*.(cc|cpp|cxx|hh|hpp|hxx)
) Shell solutions would probably need extended globbing for ergonomic reasons. |
Seems regardless of the value of |
@aprotyas this solution only works if the number of files you are excluding is small enough. I get lots of |
Hi,
some of the linters support a EXCLUDE argument where you can specify paths to not lint.
I made a test and it looks like the argument is interpreted differently in uncrustify and cpplint.
In my example, I want to exclude the file
external/cxxopts-2.1.2/include/cxxopts.hpp
.I have the following CMake code
The problem is the following.
If I do
set(_linter_excludes external/cxxopts-2.1.2/include/cxxopts.hpp)
then the file is correctly excluded bycpplint
but not byuncrustify
.On the other hand, if I do
set(_linter_excludes external)
the opposite happens (the file is correctly excluded byuncrustify
but not bycpplint
).A dummy solution consists in having both file-level as well as folder-level exclusions, but this definitely seems a problem if I had to do more advanced exclusion logic.
The text was updated successfully, but these errors were encountered: