我正在使用 cpplint 来检查我的源代码和谷歌风格指南。
Cpplint 的帮助说:
cpplint.py supports per-directory configurations specified in CPPLINT.cfg
files. CPPLINT.cfg file can contain a number of key=value pairs.
Currently the following options are supported:
"exclude_files" allows to specify a regular expression to be matched against
a file name. If the expression matches, the file is skipped and not run
through liner.
Example file:
filter=-build/include_order,+build/include_alpha
exclude_files=.*\.cc
The above example disables build/include_order warning and enables
build/include_alpha as well as excludes all .cc from being
processed by linter, in the current directory (where the .cfg
file is located) and all sub-directories.
我如何使用 cpplint:
我使用cpplint
此命令检查源文件夹中的所有文件:
cpplint src/*.c
好吧,有一个特殊文件foo.cc
不能检查。所以我尝试创建一个CPPLIN.cfg
使用该exclude_files
属性。我的文件如下所示:
set noparent
filter=-build/include_dir
exclude_files=foo.cc
尽管如此foo.cc
,仍然检查。
我已经尝试过做的事情:
我试过了 exclude_files=/.*\.cc/
。这应该排除所有以 *.cc 结尾的文件。尽管如此,仍然检查所有文件。
我试图filter
从文件中删除我的。这导致了比以前更多的错误。所以我现在确定我的CPPLINT.cfg
文件被 cpplint 找到了。
问题:
如何正确使用 cpplint 中的 exclude_files 正则表达式?