cpplint使用详解


1.cpplint.py –help来查看帮助。注意,命令行参数都是两个横线(--)

2.

Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
[--counting=total|toplevel|detailed]
<file> [file] ...

 

--verbose=3 指定错误输出级别,一共有0-5,这几个级别,指定数字后,只输出这些级别,感觉不是特别准

--output=vs7 cpplint的输出格式有’emacs’和’vc7′两种, 默认是’emacs’.

--filter=-build,-whitespace,+whitespace/comma 指定输出错误类型,-表示不输出,+表示输出

-whitespace,所有的[whitespace*]都将不输出,但是有了+whitespace/comma,则[whitespace/comma]将被输出

--counting=total

输出

Total errors found: 96

--counting=toplevel

输出

Category 'whitespace' errors found: 88
Category 'build' errors found: 8
Total errors found: 96

--counting=details

Category 'whitespace/braces' errors found: 28
Category 'whitespace/semicolon' errors found: 1
Category 'build/include' errors found: 6
Category 'whitespace/end_of_line' errors found: 6
Category 'whitespace/blank_line' errors found: 1
Category 'whitespace/comma' errors found: 14
Category 'whitespace/comments' errors found: 5
Category 'whitespace/operators' errors found: 3
Category 'whitespace/parens' errors found: 3
Category 'build/include_order' errors found: 1
Category 'build/include_what_you_use' errors found: 1
Category 'whitespace/line_length' errors found: 27
Total errors found: 96

 

file只能指定一个文件或多个文件(*),不能指定目录

所以得想个办法,在外面套一层,让它遍历整个指定目录,或者指定的多个目录

 

 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM