summaryrefslogtreecommitdiff
path: root/tools/cpplint.py
AgeCommit message (Collapse)Author
2019-04-08tools: move cpplint configuration to .cpplintRefael Ackermann
PR-URL: https://github.com/nodejs/node/pull/27098 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-04-08tools: refloat 4 Node.js patches to cpplint.pyRefael Ackermann
* Add 3 Node.js checks * Adjest cpplint.py header rules to Node.js convention Cherry-pick 12c8b4d15471cb6211b39c3a2ca5b10fa4b9f12b Original commit message: This commit is a suggestion for adding a rule for NULL usages in the code base. This will currently report a number of errors which could be ignored using // NOLINT (readability/null_usage) PR-URL: https://github.com/nodejs/node/pull/17373 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Refs: https://github.com/nodejs/node/commit/12c8b4d15471cb6211b39c3a2ca5b10fa4b9f12b Cherry-pick fc81e801913de3e3f3c0c8e26c105f983a74e539 Original commit message: Update cpplint.py to check for inline headers when the corresponding header is already included. PR-URL: https://github.com/nodejs/node/pull/21521 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Refs: https://github.com/nodejs/node/commit/fc81e801913de3e3f3c0c8e26c105f983a74e539 Cherry-pick cbc3dd997eb90d629d1b9912b7a5a40eb82343df Original commit message: src, tools: add check for left leaning pointers This commit adds a rule to cpplint to check that pointers in the code base lean to the left and not right, and also fixes the violations reported. PR-URL: https://github.com/nodejs/node/pull/21010 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Refs: https://github.com/nodejs/node/commit/cbc3dd997eb90d629d1b9912b7a5a40eb82343df Cherry-pick 902998190a55d6915b881936f6dd5b6e9cca6ad8 Original commit message: tools: fix cpplint.py header rules THIS COMMIT SHOULD GO WITH THE NEXT. IT WILL FIND NEW LINT. PR-URL: https://github.com/nodejs/node/pull/26306 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Refs: https://github.com/nodejs/node/commit/902998190a55d6915b881936f6dd5b6e9cca6ad8 PR-URL: https://github.com/nodejs/node/pull/27098 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-04-08tools: bump cpplint.py to 1.4.4Refael Ackermann
Refs: https://github.com/cpplint/cpplint/releases/tag/1.4.4 PR-URL: https://github.com/nodejs/node/pull/27098 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-04-05src: add NOLINT to js_native_.*gengjiawen
* add filter to not lint NOLINT rules PR-URL: https://github.com/nodejs/node/pull/26884 Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-12tools: fix cpplint.py header rulesRefael Ackermann
THIS COMMIT SHOULD GO WITH THE NEXT. IT WILL FIND NEW LINT. PR-URL: https://github.com/nodejs/node/pull/26306 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-02-06lib: fix a few minor issues flagged by lgtmRobin Neatherway
* Confusing (but correct) regex using `A-z` character range by accident * Add the status argument to afterShutdown PR-URL: https://github.com/nodejs/node/pull/25873 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2019-01-30tools: refloat Node.js patches to cpplint.pyRefael Ackermann
* Preserve 3 node-core checks * Preserve patch to `FileInfo.RepositoryName` * Remove TAP to logfile (unused) PR-URL: https://github.com/nodejs/node/pull/25771 Fixes: https://github.com/nodejs/node/issues/25760 Refs: https://github.com/cpplint/cpplint/blob/3d8f6f876dd6e3918e5641483298dbc82e65f358/cpplint.py Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-01-30tools: bump cpplint.py to 3d8f6f876dRefael Ackermann
PR-URL: https://github.com/nodejs/node/pull/25771 Fixes: https://github.com/nodejs/node/issues/25760 Refs: https://github.com/cpplint/cpplint/blob/3d8f6f876dd6e3918e5641483298dbc82e65f358/cpplint.py Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-10-09benchmark,doc,lib,src,test,tools: fix typosBrandon Smith
PR-URL: https://github.com/nodejs/node/pull/23302 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-10-01tools: fix cpplint --quiet optionDaniel Bevenius
Currently, the --quiet option for cpplint will generate the following error: $ tools/cpplint.py --quiet src/node.cc Traceback (most recent call last): File "tools/cpplint.py", line 6529, in <module> main() File "tools/cpplint.py", line 6497, in main filenames = ParseArguments(sys.argv[1:]) File "tools/cpplint.py", line 6437, in ParseArguments logger.addHandler(logging.FileHandler(val, mode='wb')) File "/python2.7/logging/__init__.py", line 911, in __init__ StreamHandler.__init__(self, self._open()) File "/python2.7/logging/__init__.py", line 941, in _open stream = open(self.baseFilename, self.mode) IOError: [Errno 21] Is a directory: '/Users/danielbevenius/work/nodejs/node This commit moves the FileHandler that currently exists in the quiet option to the logfile clause. It looks like this issue came about when merging in commit fee4d3ab90365aaff0d3469076c7ef8a3a91bc79 ("tools: merge custom cpplint with cpplint v1.3.0"). PR-URL: https://github.com/nodejs/node/pull/23075 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-09-18tools: merge custom cpplint with cpplint v1.3.0Christopher Hiller
Merged https://github.com/cpplint/cpplint/blob/master/cpplint.py with our customized version to enable better IDE/editor integration. Made file executable. PR-URL: https://github.com/nodejs/node/pull/22864 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-07-29tools: update cpplint to check for inline headersUjjwal Sharma
Update cpplint.py to check for inline headers when the corresponding header is already included. PR-URL: https://github.com/nodejs/node/pull/21521 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-07-27tools: define xrange() in Python 3cclauss
__xrange()__ was removed in Python 3 in favor of __range()__. This PR ensures similar functionality on both Python 2 and Python 3. Discovered via https://travis-ci.com/nodejs/node/builds/79706150 (https://github.com/nodejs/node/pull/21942). PR-URL: https://github.com/nodejs/node/pull/21945 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-06-07src, tools: add check for left leaning pointersDaniel Bevenius
This commit adds a rule to cpplint to check that pointers in the code base lean to the left and not right, and also fixes the violations reported. PR-URL: https://github.com/nodejs/node/pull/21010 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-14tools: make C++ linter reject `template<`Anna Henningsen
This one is more or less just for me. :) PR-URL: https://github.com/nodejs/node/pull/20675 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-12-01tools: add cpplint rule for NULL usageDaniel Bevenius
This commit is a suggestion for adding a rule for NULL usages in the code base. This will currently report a number of errors which could be ignored using // NOLINT (readability/null_usage) PR-URL: https://github.com/nodejs/node/pull/17373 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-10-27tools: fix cpplint.py when path contains non-asciisharkfisher
PR-URL: https://github.com/nodejs/node/pull/16047 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-10-25src: remove empty comment in node_http2.hDaniel Bevenius
This commit removes an "empty" comment in node_http2.h that I don't think was intentional and as far as I can tell not a doxygen comment or anything like that. This was not picked up by the cpp linter so a suggestion has also been added to the CheckComment function to detect these in the future. PR-URL: https://github.com/nodejs/node/pull/16400 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-06-17src,lib,test,doc: correct misspellingsRoman Reiss
PR-URL: https://github.com/nodejs/node/pull/13719 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-03-17build: add cpp linting to windows buildliusi
This PR adds cpp linting to windows build script. After this change, running command `vcbuild lint` will run both cpp linting and javascript linting on a windows machine. PR-URL: https://github.com/nodejs/node/pull/11856 Fixes: https://github.com/nodejs/node/issues/11816 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-06-28tools: allow cpplint to run outside git repoBen Noordhuis
This reapplies commit a493dab ("cpplint: make it possible to run outside git repo") from September 2015, this time with a proper status line. PR-URL: https://github.com/nodejs/node/pull/7462 Refs: https://github.com/nodejs/node/issues/2693 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-06-28tools: add back --mode=tap to cpplintBen Noordhuis
This commit reimplements commit 7b45163 ("tools: add tap output to cpplint") on top of the upgraded copy of cpplint. PR-URL: https://github.com/nodejs/node/pull/7462 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-06-28tools: disable unwanted cpplint rules againBen Noordhuis
This commit disables the build/include, build/include_alpha, build/include_order and legal/copyright warnings again. PR-URL: https://github.com/nodejs/node/pull/7462 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-06-28tools: update cpplint to r456Ben Noordhuis
PR-URL: https://github.com/nodejs/node/pull/7462 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-06-21tools: disable readability/function cpplint ruleBen Noordhuis
cpplint gets too easily confused by C++ constructs that look like function declarations but aren't. Furthermore, it's arguably a bad rule that conflicts with gcc's -Wunused-parameter flag. PR-URL: https://github.com/nodejs/node/pull/7334 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-03-07tools: reduce verbosity of cpplintSakthipriyan Vairamani
Every time `make test` is run, the cpplint prints the file it successfully linted. None of the other linters in the project does that. This patch simply removes the "Done processing" message from the cpplint. PR-URL: https://github.com/nodejs/node/pull/5578 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-08tools: list missing whitespace/if-one-line cpplintBen Noordhuis
Writing `// NOLINT(whitespace/if-one-line)` was not possible because the directive was not listed in the list of known lint rules. You can now. PR-URL: https://github.com/nodejs/node/pull/4099 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-12tools: add tap output to cpplintJohan Bergström
Implement a crude TAP13 writer for cpplint. Does its job and not much else. Only supports writing TAP output to file, not vs7 or emacs formats. PR-URL: https://github.com/nodejs/node/pull/3448 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-09-06cpplint: make it possible to run outside git repoBen Noordhuis
cpplint uses the top-level .git directory to determine what the root is for #include guards. If it doesn't find a .git directory, it walks up all the way to the system root and subsequently complains that guards must be written as HOME_USER_SRC_NODE_SRC_FILENAME_H_. This commit replaces the .git-based path munging with a fixed root path relative to the location of the cpplint script, making it possible to successfully run `make test` from an extracted tarball. Fixes: https://github.com/nodejs/node/issues/2693 PR-URL: https://github.com/nodejs/node/pull/2710 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-01-13test: create test-ci, modify test-all, fix cpplintBen Noordhuis
test: add test/addons to default test list `make test-all` and `python tools/test.py` will now also run the addon tests in test/addons. test: remove test-npm from test-all make target The test-npm target builds documentation, changes versioned files, clutters the current working directory with artifacts, etc. In short, it doesn't seem quite ready for inclusion in `make test-all`. test: add test-ci target, reduced test-all Add a test-ci target that is like test-all minus the (slow) pummel and gc test suites. This is primarily intended for the continuous integration, where we want decent coverage but don't want to wait for ages for tests to complete. cpplint: add -license/copyright to default filters Commit 3e1b1dd ("Remove excessive copyright/license boilerplate") trips up the copyright boilerplate style check. Disable it. PR-URL: https://github.com/iojs/io.js/pull/314 Reviewed-By: Rod Vagg <rod@vagg.org>
2013-10-17cpplint: disallow if one-linersFedor Indutny
2013-10-17cpplint: disallow comma-first in C++Fedor Indutny
2013-08-15tools: cpplint: fix NOLINT(build/include_order)Ben Noordhuis
And build/include, build/include_alpha and readability/streams probably too, though those are currently unused and therefore untested.
2013-07-31tools: cpplint: fix up build/include_order ruleBen Noordhuis
Change the build/include_order rule to match our preference: project headers before system headers. The rationale is that system headers before project headers makes it easy to slip in bugs where a project header that requires a definition from a system header, forgets to include the system header but still compiles because the source files that include the project header coincidentally include the system header too. A good example is the size_t type. A project header file that needs the definition of size_t should include stddef.h but forgetting to do so will probably go unnoticed for a long time because almost every other system header includes stddef.h (either directly or indirectly) and almost every source file includes one or more system headers. Ergo, project headers before system headers. It's a good thing.
2013-07-31cpplint: make lint rules closer to node's sourceFedor Indutny
* Support C-style header guards (/* comments */) * Support `class NODE_EXTERN something` * Support `} // extern "C"` closures * Ignore header order * Ignore `long/short` usage (because of OpenSSL's API)
2013-05-14tools: remove unnecessary cpplint rulesisaacs
We don't actually care about header order much, and since we never use stl classes, 'string' isn't an issue for node ever.
2010-12-01Import cpplint.pyRyan Dahl
make cpplint make jslint make lint