如何使用cpplint忽略文件夹

时间:2017-02-06 03:44:19

标签: c++ cpplint

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

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

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

cpplint --recursive --exclude=.build src

但这没有效果。

我也尝试过:

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

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

3 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

要在所有子文件夹上递归运行而不检查特定的文件夹或文件,应该磨擦第一个参数以从递归检查中排除,只有在此之后才能启用递归。

我正在使用以下命令:

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

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

答案 2 :(得分:-1)

cpplint --exclude=fold/ * --exclude=fold/ * / * --exclude=fold/ * / * / * 
   exam.c