[go: up one dir, main page]

Jump to content

Cpplint: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Rearrange + Give more details about usage + Add external link to Google's coding style guides
Line 1: Line 1:
'''cpplint''' or '''cpplint.py''' is an open source [[lint (software)|lint]]-like tool developed by [[Google]],
'''cpplint''' is an open source [[lint (software)|lint]]-like tool developed by [[Google]], designed to ensure that [[C++]] code conforms to Google's coding style guides. It reads source code files and flags deviations from the style guide. It suffers from both [[false positives]] and false negatives. False positives can be eliminated by tagging lines with //NOLINT. <ref>{{cite web|title=Google C++ Style Guide|first=Benjy|last=Weinberger|url=http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml}}</ref>
designed to ensure that [[C++]] code conforms to [http://google.github.io/styleguide/cppguide.html Google's coding style guides].
cpplint is implemented as [[Python (programming language)|Python]] script.<ref>{{cite web|title=GIT URL for cpplint.py|first=Google|url=https://github.com/google/styleguide/tree/gh-pages/cpplint}}</ref>


cpplint implements what Google considers to be "best practices" in C++ coding. It also identifies [[syntax errors]]. It is rules based, and uses a number of heuristics to identify bad code. <ref>{{cite web|url=http://etd.ohiolink.edu/send-pdf.cgi/Dutko%20Adam%20M.pdf?csu1313678735|last=Dutko|first=Adam|title=THE RELATIONAL DATABASE: A NEW STATIC ANALYSIS TOOL?}}</ref>
Therefore cpplint implements what Google considers to be ''"best practices"'' in C++ coding.
The script cpplint.py reads source code files and flags deviations from the style guide.
It also identifies [[syntax errors]].
It is rules based, and uses a number of heuristics to identify bad code.<ref>{{cite web|url=http://etd.ohiolink.edu/send-pdf.cgi/Dutko%20Adam%20M.pdf?csu1313678735|last=Dutko|first=Adam|title=THE RELATIONAL DATABASE: A NEW STATIC ANALYSIS TOOL?}}</ref>


cpplint.py suffers from both [[false positives]] and false negatives.
False positives can be eliminated by tagging lines with <code>// NOLINT</code><ref>{{cite web|title=Google C++ Style Guide, section cpplint|first=Benjy|last=Weinberger|url=http://google.github.io/styleguide/cppguide.html#cpplint}}</ref> (or
<code>// NOLINT(rule)</code> to suppress only the incriminated <code>rule</code> category).

Moreover rules can be fined-grained selected using the options <code>--verbose</code> and <code>--filter</code>.
Line length rule can be configured with option <code>--linelength</code>
and file extensions can be configured with <code>--extensions</code> (by default: 'h', 'cpp', 'cc', 'cu' and 'cuh').
The options can be stored in a configuration file <code>CPPLINT.cfg</code>.

cpplint is implemented as [[Python (programming language)|Python]] script.<ref>{{cite web|title=GIT URL for cpplint.py|first=Google|url=https://github.com/google/styleguide/tree/gh-pages/cpplint}}</ref>
cpplint is distributed under the [[BSD license| 3 clause BSD license]].
cpplint is distributed under the [[BSD license| 3 clause BSD license]].



Revision as of 06:37, 20 October 2015

cpplint or cpplint.py is an open source lint-like tool developed by Google, designed to ensure that C++ code conforms to Google's coding style guides.

Therefore cpplint implements what Google considers to be "best practices" in C++ coding. The script cpplint.py reads source code files and flags deviations from the style guide. It also identifies syntax errors. It is rules based, and uses a number of heuristics to identify bad code.[1]

cpplint.py suffers from both false positives and false negatives. False positives can be eliminated by tagging lines with // NOLINT[2] (or // NOLINT(rule) to suppress only the incriminated rule category).

Moreover rules can be fined-grained selected using the options --verbose and --filter. Line length rule can be configured with option --linelength and file extensions can be configured with --extensions (by default: 'h', 'cpp', 'cc', 'cu' and 'cuh'). The options can be stored in a configuration file CPPLINT.cfg.

cpplint is implemented as Python script.[3] cpplint is distributed under the 3 clause BSD license.

References

  1. ^ Dutko, Adam. "THE RELATIONAL DATABASE: A NEW STATIC ANALYSIS TOOL?" (PDF).
  2. ^ Weinberger, Benjy. "Google C++ Style Guide, section cpplint".
  3. ^ "GIT URL for cpplint.py". {{cite web}}: |first= has generic name (help); |first= missing |last= (help)