1

你如何告诉cpplint忽略特定名称的文件夹?

我有.build包含自动生成文件的文件夹,当我运行cpplint --recursive src它时,它会遍历这些文件夹并发现大量我不关心的错误。

我尝试使用该--exclude参数,例如:

cpplint --recursive --exclude=.build src

但这没有任何效果。

我也试过:

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

和其他使用通配符的变体,但这些也没有效果。

4

3 回答 3

2

试试这个 :

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

您可以将此参数与您的 cpplint 命令一起使用:

find $PWD -not \( -path $PWD/<folder1> -prune \) -not \( -path $PWD/<folder2> -prune \) -not \( -path $PWD/<folder3> -prune \) -name *.cpp
于 2017-02-06T05:10:55.917 回答
0

要在所有子文件夹上递归运行而不检查特定文件夹或文件,第一个参数应该是从递归检查中排除的 whit,然后才启用递归。

我正在使用以下命令:

cpplint --exclude=./src/autogenerated --recursive ./src/ > /dev/null 2> ./codestyle.log

在我的情况下,cpplint将以递归方式在所有./src文件夹中运行,但将省略./src/autogenerated dir
所有标准输出将被重定向到 /dev/null 垃圾,并且我要修复的所有错误都将被重定向到我的日志文件./codestyle.log

于 2020-07-23T08:16:51.857 回答
-2
cpplint --exclude=fold/ * --exclude=fold/ * / * --exclude=fold/ * / * / * 
   exam.c
于 2019-09-17T05:42:40.990 回答