Search code examples
c++cpplint

How to ignore folders with cpplint


How do you tell cpplint to ignore folders of a specific name?

I have .build folders that contain auto-generated files, and when I run cpplint --recursive src it traverses these folders and finds a tons of errors I don't care about.

I've tried using the --exclude parameter, like:

cpplint --recursive --exclude=.build src

but that has no effect.

I've also tried:

cpplint --recursive --exclude=*/.build src

and other variations that use wildcards, but those also have no effect.


Solution

  • Try this :

    ./cpplint.py \
        $( find . -name \*.h -or -name \*.cc | grep -vE "^\.\/<excluded_folder_name>\/" )
    

    You can make use of this argument along with your cpplint command:

    find $PWD -not \( -path $PWD/<folder1> -prune \) -not \( -path $PWD/<folder2> -prune \) -not \( -path $PWD/<folder3> -prune \) -name *.cpp