Commit Graph

35 Commits (e30d05137000c2f1ab463b394734c7faaa8cf447)

Author SHA1 Message Date
Jordan Bayles 91a32c5e39 CppLint changes for VSCode cpplint plugin
This patch makes some changes to the cpplint.py script for integration
with the VSCode cpplint plugin, available here:

https://marketplace.visualstudio.com/items?itemName=mine.cpplint

Specifically, the "--repository" and "--headers" options currently cause
our version of cpplint to crash, when we should at worst ignore them. A
minor messaging tweak outputting the contents of the GetoptError, to
make debugging input argument bugs easier, is included

Change-Id: Id78616f5e2fdecb7da650042f0658623477ef9cb
Reviewed-on: https://chromium-review.googlesource.com/c/1481938
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Jordan Bayles <jophba@chromium.org>
6 years ago
Quinten Yearsley 4809957b79 [cpplint] Ignore fn_size check for macros with digits
In the cpplint fn_size check, there's a part where it explicitly
says to ignore macros, BUT the check for macro names didn't allow
for digits, which are present in the IPC_* macro names, which
look like "IPC_SYNC_MESSAGE_CONTROL4_1".

There are two interesting things about this:

1. This bug was filed in 2011! Yay for fixing a 5-digit crbug with
one-line fix!
2. This is a great example of how cpplint's regex-based checking is
error-prone compared to something that actually has access to an
abstract syntax tree.

Bug: 83036
Change-Id: I49acd80c265d7f7bc633f2092388525b4518ae23
Reviewed-on: https://chromium-review.googlesource.com/c/1483283
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
6 years ago
Avi Drissman 4157ba1c3c Update cpplint.
da90c53e3d was incorrect; the size()
functions take almost anything, not just word characters, and
std::extent() uses brackets.

BUG=837308

Change-Id: I6ee75a5da7a021758bbfb0996aeaef81f2003cd9
Reviewed-on: https://chromium-review.googlesource.com/c/1401581
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
6 years ago
Avi Drissman da90c53e3d Update cpplint.
Using base/std::size and std::extent does not result in the creation
of a VLA; cpplint should not warn on their use.

BUG=837308

Change-Id: Ie133b2144b6c1c9f4f5e406144f28b333a212197
Reviewed-on: https://chromium-review.googlesource.com/c/1399961
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
6 years ago
Clemens Hammacher 2cc6e25536 [cpplint] Fix regexp for class decorators
This also allows digits in class decorators, to also match macros like
V8_EXPORT_PRIVATE.

Note: I uploaded a pull request for the (previous) upstream at
https://github.com/google/styleguide/pull/422, but then was told that
that repository is not maintained any more.

R=jochen@chromium.org

Bug: chromium:916550

Change-Id: I24cd1829b794b296be8e0c2829271c746751ee1c
Reviewed-on: https://chromium-review.googlesource.com/c/1383472
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
6 years ago
Sergiy Byelozyorov 7999d92680 Revert "cpplint: Pull in upstream changes"
This reverts commit f7e1e10db5.

Reason for revert: breaks V8 presubmit, e.g. https://ci.chromium.org/p/v8/builders/luci.v8.try/v8_presubmit/b8943030202460843984

Original change's description:
> cpplint: Pull in upstream changes
> 
> The changes include:
> - root flag now can process non-subdirectories
> -- e7ddd2af62
> 
> - root flag can be configured with CPPLINT.cfg
> -- 2322e4ffaa
> 
> - root setting is relative to the CPPLINT.cfg file
> -- 8a87a46cc7
> 
> - Cleans up header file detection for hpp and hxx
> 
> - Adds quite mode
> 
> Bug: 852898
> 
> Change-Id: Id44bbfadc913cc27192049ab9a222f22d0deab5d
> Reviewed-on: https://chromium-review.googlesource.com/1108381
> Commit-Queue: Amin Hassani <ahassani@chromium.org>
> Reviewed-by: Aaron Gable <agable@chromium.org>

TBR=agable@chromium.org,ahassani@chromium.org

Change-Id: I3d380ecf8cb80000d7f7dcc0a2c75bb8a12d2a51
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 852898
Reviewed-on: https://chromium-review.googlesource.com/1111797
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Sergiy Byelozyorov <sergiyb@chromium.org>
7 years ago
Amin Hassani f7e1e10db5 cpplint: Pull in upstream changes
The changes include:
- root flag now can process non-subdirectories
-- e7ddd2af62

- root flag can be configured with CPPLINT.cfg
-- 2322e4ffaa

- root setting is relative to the CPPLINT.cfg file
-- 8a87a46cc7

- Cleans up header file detection for hpp and hxx

- Adds quite mode

Bug: 852898

Change-Id: Id44bbfadc913cc27192049ab9a222f22d0deab5d
Reviewed-on: https://chromium-review.googlesource.com/1108381
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
7 years ago
Clemens Hammacher e864a3f217 Remove presubmit check for DISALLOW_* macros
Before C++11, we were using a hack to disable copy constructors or copy
assignment by declaring the methods private and not implementing them.
This hack required the respective macros to be placed in the private:
declarations of a class.
The macros have switched to use the C++11 "= delete" syntax some time
ago in both v8 and chromium:
https://codereview.chromium.org/1123723003/
https://codereview.chromium.org/2017213002

Also the comments are now updated, since the macros do not need to be
in the private: declarations any more:
https://chromium-review.googlesource.com/c/577687
https://chromium-review.googlesource.com/c/578027

This change removes the presubmit check that checked that the
macros are only used in the private declarations.

This is a cherry-pick from https://github.com/google/styleguide/pull/265.

R=jochen@chromium.org

Change-Id: I224005a17c3de2569b64622e6cf8c9688665637d
Reviewed-on: https://chromium-review.googlesource.com/579187
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
8 years ago
Alexandr Ilin ff294c3001 cpplint: Update Google Style Guide's URL
The link to https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml is
no longer available. Point to GitHub instead.

Change-Id: I5a1010b42bd2e70348ae7ca6c5783d65520ff565
Reviewed-on: https://chromium-review.googlesource.com/488602
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
danakj d7f5675931 Teach the explicit constructor check about constexpr.
If a constructor is marked constexpr it evades the explicit constructor
check right now, since the check only knows about the inline keyword.
Teach it that constexpr can be used also.

Change-Id: Ia76ddd00b69c5a76a385d22a2b9eb18b690bd8c8
Reviewed-on: https://chromium-review.googlesource.com/445932
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
agable f39c33382a Use a whitelist for depot_tools pylint instead
R=maruel@chromium.org
BUG=644995

Review-Url: https://codereview.chromium.org/2353393004
9 years ago
qyearsley 12fa6ff69b Run auto-spell-checker (codespell) on files in depot_tools.
This should only change spelling in:
 - messages that are printed
 - comments
 - docstrings

Review-Url: https://codereview.chromium.org/2277513002
9 years ago
sdefresne 263e92872f Add new parameter --project_root to cpplint.py.
Chrome on iOS downstream repository tracks Chromium via DEPS and wants
to use cpplint canned presubmit check but the cpplint.py errors due at
the include guard as it stops at the inner most git repository.

Add a new parameter --project_root to cpplint.py. If set, it overrides
the automatic detection of the project root that searches the root of
the version control repository.

The --root parameter cannot be used as it is used after the automatic
resolution is performed (and allow chopping the head of the relative
path while the need is to expend the path to include ios_internal/).

BUG=598090

Review-Url: https://codereview.chromium.org/2036773002
9 years ago
lhchavez 2d1b6dae5a Support C++11 types in build/include_what_you_use
This is a cherry-pick of https://github.com/google/styleguide/pull/159
(plus some code that it depends on).

BUG=627514
TEST=cpplint_unittest.py

Review-Url: https://codereview.chromium.org/2146553003
9 years ago
lhchavez 9b2173c419 Make build/include_what_you_use more consistent
This is a cherry-pick of https://github.com/google/styleguide/pull/158/

BUG=627202
TEST=cpplint_unittest.py

Review-Url: https://codereview.chromium.org/2147593002
9 years ago
avakulenko@chromium.org 764ce71cb5 Update cpplint.py to r456.
This is a cherry-pick of the GitHub commit, created after merging relevant
changes from Google's internal cpplint.py implementation.

456 - Tweak lint to sometimes allow { on line following array initialization.
455 - Recognize more types.
454 - Try a bit harder to detect templated types.
453 - Changed error message wording on build/storage_class to be less ambiguous.
452 - Recognize more types to silence false positives for brace warnings.
451 - <skipped>
450 - <skipped>
449 - Ignore whitespace/tab for Linux Kernel files.
448 - Remove some more false positive lint warnings for int64{n}.
447 - Just one warning message for line length is enough, don't need two.
446 - Allow braced conversions to int16, uint64, etc. per the style guide.
445 - Fixed handling of backslash escapes for checking whether a "//" is quoted.
444 - Reduced dependency on hardcoded .cc extension.
443 - Disable single-arg constructor checks by default, since ClangTidy has the
      same check. We could just delete the check entirely, but it's slightly
      useful in places that can't run ClangTidy.
442 - Fix matching of macro names in CheckTrailingSemicolon to include digits.
441 - Deleted checks:
      - All checks for RValue references.
      - Spacing check around boolean &&, because those look like RValue
        references.
      A huge amount of code and effort were dedicated to tell RValue
      references apart from boolean expressions, and to differentiate
      allowed versus banned RValue references. But we still get regular
      false positives from this one check. Rather than making the check
      more complex than what it already is, it seemed safer to just delete
      it altogether for now, and have a different process for catching
      RValue references.
440 - Add rule to cpplint to throw error on empty if statement bodies without
      else clauses. If statement bodies with comments are not considered empty.
439 - Allow spaces before closing brace of namespace block so that namespaces
      inside of macro definitions (where the entire macro definition is
      indented) are not treated as errors.
438 - cpplint: fix a false positive on `new const int(x)`.
437 - Only check for function length when current line is inside a function.
436 - cpplint: Catch static `std::string` instances as well as those written as
      `string`. Previously users would sometimes work around the lint warning by
      changing their code to even worse code by adding the "std::" prefix.
435 - cpplint: Be a little smarter about warning on indentation.
434 - cpplint: Remove false positives on some functions returning string const&.
433 - cpplint: improve diagnostics of global/static string objects.
432 - Allow non-const reference parameters for iostream based types.
431 - Better handling of raw strings inside comments.
430 - <noop>
429 - <skipped>
428 - <skipped>
427 - Add support to CHECK_NOTNULL when checking if a member variable is
      initialized with itself.
426 - Allow suppressing specific warnings in C headers.
425 - Allow spaces before parens for inline assembly.
424 - Remove lint checks for {EXPECT,ASSERT}_.*_M.
423 - Allow comment lines of more than 80 characters if they contain a single
      "word" (without any spaces).
422 - cpplint: Warn on inclusion of C++14 headers.
421 - cpplint: recognize <shared_mutex> as a standard library header.
420 - Add <scoped_allocator> to cpplint's list of C++ standard headers.
419 - Add cpplint check for tr1/ headers. We removed the nanny guards for these
418 - <skipped>
417 - Update the styleguide and cpplint to allow unnamed parameters
416 - Remove the rule explicitly banning non-default move operations.
415 - Remove the check for explicit multi arg constructors
414 - Include clarity of lambda default captures in "pros" section, mention
      of capturing `this` and lambdas which escape the current scope in "cons".
      Soften the ban on default captures to a preference, with admonition against
      using them for capturing `this` or when they will escape the current scope.
      This is a fairly straightforward change with a brief inclusion
      of 2 problematic cases for implicit capture. As this is the style
      guide, I'm not sure how much more detail is appropriate.
413 - Fixed a bug by making regex in CleanseRawStrings match multiple raw strings
      on a single line in left-to-right order.
412 - Fixed false positive for classes derived using decltype()
411 - <skipped>
410 - Recognize '1LL<<20' as numeric and don't flag it for spacing.

BUG=

Review-Url: https://codereview.chromium.org/1959503003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300481 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
kjellander@chromium.org 95a5ad89de Revert of Convert cpplint.py to work with nested git repositories. (patchset #1 id:1 of https://codereview.chromium.org/1897153003/ )
Reason for revert:
This breaks WebRTC presubmit on the buildbots (due to /b/build being a Git repo, which in turn contains the checkout). See  https://bugs.chromium.org/p/webrtc/issues/detail?id=5818 for more details.

It seems it also broke other projects (rakuco's comment #15).



Original issue's description:
> Convert cpplint.py to work with nested git repositories.
> 
> Chrome on iOS downstream repository tracks Chromium via DEPS and wants
> to use cpplint canned presubmit check but the cpplint.py errors due at
> the include guard as it stops at the inner most git repository.
> 
> Change cpplint.py to look for the outermost git repository when looking
> for the repository root.
> 
> BUG=598090
> 
> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=300085

TBR=iannucci@chromium.org,skym@chromium.org,sdefresne@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=598090

Review URL: https://codereview.chromium.org/1919483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300119 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
sdefresne@chromium.org 3962862d75 Convert cpplint.py to work with nested git repositories.
Chrome on iOS downstream repository tracks Chromium via DEPS and wants
to use cpplint canned presubmit check but the cpplint.py errors due at
the include guard as it stops at the inner most git repository.

Change cpplint.py to look for the outermost git repository when looking
for the repository root.

BUG=598090

Review URL: https://codereview.chromium.org/1897153003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300085 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
skym@chromium.org 3990c419a3 Moving swap IWYU from <algorithm> to <utility>.
In C++11 std::swap was moved from <algorithm> to <utility>. As such,
lint needed to be updated to look for/suggest <utility> when it finds
std::swap. The IWYU logic is a little bit different for <utility>
functions, including swap, because they do not typically include
template parameters, unlike most other std:: functions. Reworked the
existing algorithm pattern to be more generic and support multiple
differet headers. Did not rename/all caps _re_pattern_templates as it
is referenced/modified outside of cpplint.py.

BUG=584689

Review URL: https://codereview.chromium.org/1673543004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@298622 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
avakulenko@google.com 255f2bea85 Update cpplint.py to r141.
This just a copy of cpplint.py from upstream [1].

[1] https://code.google.com/p/google-styleguide/source/detail?spec=svn141&r=141

The change in gclient_scm.py is to address a presubmit check error
which was introduced by https://codereview.chromium.org/227163002
"print_func" parameter was being passed to a function instead of
the object constructor.

BUG=None
NOTRY=True

Change-Id: I4dca890d5f02957ddae33c4bd4269fd37758be3d

Review URL: https://codereview.chromium.org/777533005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293276 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
avakulenko@google.com 68a4fa6a7d depot_tools: update cpplint.py to r137
Implements 'linelength' option in CPPLINT.cfg.
See:
https://code.google.com/p/google-styleguide/source/browse/trunk/cpplint/cpplint.py?r=137

BUG=None
TEST=None

Change-Id: I7b017078d997dfafc524a2f50a32289391d011f9

Review URL: https://codereview.chromium.org/495413002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291601 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
avakulenko@google.com 59146756b6 Update cpplint.py to r136.
The only difference compared to upstream[1] is the shebang line from
depot_tools.

[1] https://code.google.com/p/google-styleguide/source/browse/trunk/cpplint/cpplint.py?r=136

BUG=None

Review URL: https://codereview.chromium.org/460003003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@288783 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
avakulenko@google.com 174499398f depot_tools: modify cpplint.py to allow CPPLINT.cfg overrides
Added the ability to provide CPPLINT.cfg files to provide
linter message filters per sub-directory and special exclusion
rules. Each file can have instructions like:

filter=-build/include_order,+build/include_alpha
exclude_files=.*\.cc

The above disables build/include_order warning and enables
build/include_alpha as well as excludes all .cc from being
processed by linter, in the current directory (where the .cfg
file is located) and all sub-directories.

Related CL: https://chromium-review.googlesource.com/#/c/209384/

BUG=chromium:395296
TEST=ran cpplint.py on a bunch of directories in platform2/

Review URL: https://codereview.chromium.org/406373002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@285999 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
avakulenko@google.com d39bbb5b30 Update cpplint.py to r133.
The only difference compared to upstream[1] is the shebang line from
depot_tools.

[1] https://code.google.com/p/google-styleguide/source/browse/trunk/cpplint/cpplint.py?spec=svn131&r=133

BUG=None

Review URL: https://codereview.chromium.org/317053002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@274946 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
raphael.kubo.da.costa@intel.com 331fbc43e3 Update cpplint.py to r119.
The only difference compared to upstream[1] is the shebang line from
depot_tools r136603.

[1] https://code.google.com/p/google-styleguide/source/browse/trunk/cpplint/cpplint.py?spec=svn131&r=119

R=maruel@chromium.org
BUG=

Review URL: https://codereview.chromium.org/269013009

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@269187 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
mazda@chromium.org 3fffcec86b Update cpplint.py to r104.
Review URL: https://chromiumcodereview.appspot.com/15864011

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@204686 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago
erg@chromium.org d528f8b15d Change the python hashbang in cppint.py
Review URL: https://chromiumcodereview.appspot.com/10391070

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@136603 0039d316-1c4b-4281-b951-d872f2087c98
13 years ago
erg@chromium.org 8f927567f9 Upstream cpplint.py r79 ("Convert windows path seperators to unix like while doing IncludeWhatYouUse.")
Review URL: http://codereview.chromium.org/9159036

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@119713 0039d316-1c4b-4281-b951-d872f2087c98
13 years ago
erg@chromium.org c452feaec9 Update cpplint.py to r78.
Review URL: http://codereview.chromium.org/9113091

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@119290 0039d316-1c4b-4281-b951-d872f2087c98
13 years ago
erg@chromium.org 7956a87b76 Commit cpplint.py r77 to depot_tools.
Committing on behalf of Reid Kleckner <rnk@google.com>.

BUG=102890

Review URL: http://codereview.chromium.org/8676053

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@112099 0039d316-1c4b-4281-b951-d872f2087c98
13 years ago
asvitkine@chromium.org 8b8d8bef35 Add lint check against "Foo *bar" and "Foo &bar" declarations.
Depends on extension mechanism for cpplint.py: http://codereview.appspot.com/4950069/

Pulls r74 of cpplint.py from:
http://google-styleguide.googlecode.com/svn-history/r74/trunk/cpplint/cpplint.py

Taken from WebKit's fork of cpplint.py.

WebKit patch was: http://trac.webkit.org/changeset/46856

Credit Torch Mobile, Inc. who have contributed the WebKit patch in question.

BUG=none
TEST=Run gcl lint on a CL that has a Foo *bar style declaration.

Review URL: http://codereview.chromium.org/7834045

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@100151 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
erg@google.com 35589e679d Update cpplint.py to r62.
Review URL: http://codereview.chromium.org/5186001

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@66483 0039d316-1c4b-4281-b951-d872f2087c98
14 years ago
erg@google.com 26970fa907 - Add a presubmit check that lints C++ files (will submit CLs that
add this to PRESUBMIT.py in the chromium tree later).
- Update cpplint.py to the latest version from the style guide.

Review URL: http://codereview.chromium.org/395022

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@32180 0039d316-1c4b-4281-b951-d872f2087c98
16 years ago
erg@google.com 6317a9c177 Copy a newer release of cpplint.py from google-styleguide.
Review URL: http://codereview.chromium.org/147119

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@19206 0039d316-1c4b-4281-b951-d872f2087c98
16 years ago
maruel@google.com fb2b8eb2e2 Create the Next Generation of depot_tools. Eh.
Review URL: http://codereview.chromium.org/92087

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@14349 0039d316-1c4b-4281-b951-d872f2087c98
16 years ago