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