[go: up one dir, main page]

Jump to content

Cpplint: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Update content to match source.
 
(21 intermediate revisions by 18 users not shown)
Line 1: Line 1:
{{Short description|Open source 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://rocs-toolkit.googlecode.com/svn/trunk/doc/google_styleguide.pdf}}</ref>
{{Infobox software
cpplint is implemented as [[Python (programming language)|Python]] script.<ref>{{cite web|title=Subversion trunk URL for cpplint.py|first=Google|url=http://google-styleguide.googlecode.com/svn/trunk/cpplint/}}</ref>
| name = cpplint
| title = cpplint
| logo =
| screenshot =
| caption =
| developer = [[Google]]
| released = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} -->
| discontinued =
| latest release version =
| latest release date =
| latest preview version =
| latest preview date =
| repo = {{URL|https://github.com/google/styleguide}}
| programming language = [[Python (programming language)|Python]]
| operating system =
| platform =
| size =
| language =
| language count = <!-- DO NOT include this parameter unless you know what it does -->
| language footnote =
| genre = [[Static program analysis]] tool
| license = [[3-clause BSD license]]
| website = {{URL|google.github.io/styleguide/}}
}}
'''cpplint''' or '''cpplint.py''' is an open source [[lint (software)|lint]]-like tool developed by [[Google]],
designed to ensure that [[C++]] code conforms to [https://google.github.io/styleguide/cppguide.html Google's coding style guides].


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 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 thesis |url=https://engagedscholarship.csuohio.edu/cgi/viewcontent.cgi?context=etdarchive&article=1732#page=20 |format=PDF |last=Dutko |first=Adam M. |title=The Relational Database: a New Static Analysis Tool? |date=2011 |oclc=750403495 |issn=2572-3480 |number=733 |page=20 |type=Master of Science |publisher=Cleveland State University |url-status=live |archive-url=https://web.archive.org/web/20180518113320/https://engagedscholarship.csuohio.edu/cgi/viewcontent.cgi?referer=&httpsredir=1&article=1732&context=etdarchive |archive-date=18 May 2018}}</ref>

Cpplint is not perfect, as it can suffer from occasional false positives and negatives. Nevertheless, it is still a very useful tool for style enforcement.<ref>{{cite web|title=Google C++ Style Guide, section cpplint|first=Benjy|last=Weinberger|url=https://google.github.io/styleguide/cppguide.html#cpplint}}</ref>

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

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

==See also==
* [https://github.com/google/styleguide/tree/gh-pages/cpplint google/styleguide/cpplint - GitHub]
* [https://pypi.python.org/pypi/cpplint Advanced fork of cpplint on PyPI]


==References==
==References==
{{reflist}}
{{Reflist}}

{{Google FOSS}}

[[Category:Static program analysis tools]]
[[Category:Static program analysis tools]]
[[Category:Google software]]
[[Category:Google software]]
[[Category:Software using the BSD license]]
{{programming-software-stub}}

Latest revision as of 08:06, 26 November 2023

cpplint
Developer(s)Google
Repositorygithub.com/google/styleguide
Written inPython
TypeStatic program analysis tool
License3-clause BSD license
Websitegoogle.github.io/styleguide/

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 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 is not perfect, as it can suffer from occasional false positives and negatives. Nevertheless, it is still a very useful tool for style enforcement.[2]

Moreover rules can be fine-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'). Some options can be stored in a configuration file CPPLINT.cfg.

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

See also[edit]

References[edit]

  1. ^ Dutko, Adam M. (2011). The Relational Database: a New Static Analysis Tool? (PDF) (Master of Science). Cleveland State University. p. 20. ISSN 2572-3480. OCLC 750403495. Archived from the original on 18 May 2018.
  2. ^ Weinberger, Benjy. "Google C++ Style Guide, section cpplint".
  3. ^ Google. "GIT URL for cpplint.py". GitHub.