Commit Graph

78 Commits (4153bf1f8c172fcb58593193238b0a928e58e61e)

Author SHA1 Message Date
Gregory P. Smith 099770e27c
Merge pull request #580 from FaresSalem/gh-pages
Update style guideline URL
2022-08-06 17:37:10 -07:00
FaresSalem 61bf629373
Update style guideline URL 2020-10-06 17:15:25 +02:00
Alex Light 6c31e522d9 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for
reference

cpplint.py is copied into AOSP from this github version so update it
here first.

Bug: 161896447
Test: None (comments only)
2020-07-28 18:21:22 -07:00
Neal Richardson 08268efb06
Remove blacklist/whitelist from cpplint.py 2020-06-19 13:27:01 -07:00
Alex Light 26470f9ccb Add support for c++17 tuple destructuring (#487)
C++17 adds support for tuple destructuring. This allow one to write
code such as:

```
std::pair<int, int> span = getSpan();
auto [start, end] = span;

// Use start as span.first and end as span.second
```

This makes cpplint recognize and allow a space before the '[' in this
situation.

This is a purposeful divergence from the internal version where the
entire whitespace/braces category was removed. It was decided to leave
the checks in since this is sometimes used without other formatting
tools.

Test: manual
2019-11-19 12:52:07 -05:00
284km 43d512ba13 Fix a typo in cpplint
s/seperated/separated
2018-04-15 22:02:40 +09:00
Johan Dahlberg 3ac49add59 Fixed _root_debug related crash 2018-04-13 10:11:22 +02:00
Mmanu Chaturvedi b280a73124 Fix Issue 337 2018-04-05 12:41:28 -04:00
cclauss 099f059086
cpplint_unittest.py: Define xrange for Python 3 2018-03-12 18:19:10 +01:00
cclauss d98652e03b
Update cpplint.py 2018-03-12 18:14:26 +01:00
cclauss 7e4c8b9b6b
Define xrange() for Python 3
flake8 testing of https://github.com/google/styleguide on Python 3.6.3

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./cpplint/cpplint.py:1526:12: F821 undefined name 'xrange'
  for i in xrange(startpos, len(line)):
           ^
./cpplint/cpplint.py:1755:15: F821 undefined name 'xrange'
  for line in xrange(1, min(len(lines), 11)):
              ^
./cpplint/cpplint.py:1957:12: F821 undefined name 'xrange'
  for i in xrange(1, len(raw_lines) - 1):
           ^
./cpplint/cpplint.py:2298:14: F821 undefined name 'xrange'
    for i in xrange(linenum - 1, self.starting_linenum, -1):
             ^
./cpplint/cpplint.py:3080:26: F821 undefined name 'xrange'
    for start_linenum in xrange(linenum, clean_lines.NumLines()):
                         ^
./cpplint/cpplint.py:3537:14: F821 undefined name 'xrange'
    for i in xrange(first_line, last_line + 1, 1):
             ^
./cpplint/cpplint.py:3601:19: F821 undefined name 'xrange'
    for offset in xrange(endlinenum + 1,
                  ^
./cpplint/cpplint.py:4155:14: F821 undefined name 'xrange'
    for i in xrange(linenum + 1, end_line):
             ^
./cpplint/cpplint.py:4283:23: F821 undefined name 'unicode'
  if isinstance(line, unicode):
                      ^
./cpplint/cpplint.py:4928:12: F821 undefined name 'xrange'
  for i in xrange(linenum, max(-1, linenum - 10), -1):
           ^
./cpplint/cpplint.py:4949:12: F821 undefined name 'xrange'
  for i in xrange(linenum, max(-1, linenum - 10), -1):
           ^
./cpplint/cpplint.py:4965:12: F821 undefined name 'xrange'
  for i in xrange(linenum, 1, -1):
           ^
./cpplint/cpplint.py:5066:20: F821 undefined name 'xrange'
          for i in xrange(startline, linenum + 1):
                   ^
./cpplint/cpplint.py:5090:14: F821 undefined name 'xrange'
    for i in xrange(linenum - 1, max(0, linenum - 10), -1):
             ^
./cpplint/cpplint.py:5121:14: F821 undefined name 'xrange'
    for i in xrange(2):
             ^
./cpplint/cpplint.py:5284:14: F821 undefined name 'xrange'
    for i in xrange(linenum - 1, max(0, linenum - 5), -1):
             ^
./cpplint/cpplint.py:5503:18: F821 undefined name 'xrange'
  for linenum in xrange(clean_lines.NumLines()):
                 ^
./cpplint/cpplint.py:5639:21: F821 undefined name 'xrange'
  for start_line in xrange(linenum, min(linenum + 3, clean_lines.NumLines())):
                    ^
./cpplint/cpplint.py:5654:12: F821 undefined name 'xrange'
  for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())):
           ^
./cpplint/cpplint.py:5911:15: F821 undefined name 'xrange'
  for line in xrange(clean_lines.NumLines()):
              ^
```
2018-03-12 18:13:00 +01:00
Ted Osborne 505ba68c74 Revert "Project import generated by Copybara."
This reverts commit 54cca78d64.
2018-01-30 12:36:50 -05:00
Google Python team 54cca78d64 Project import generated by Copybara.
PiperOrigin-RevId: 179577576
2018-01-30 12:10:03 -05:00
Igor Murashkin 4e8e56fb65 cpplint: Fix unittests when the styleguide directory is named otherwise
Don't hardcode the 'styleguide' directory in unit tests, instead
get it from the ../.. basename.
2017-11-10 16:52:24 -08:00
Igor Murashkin e8ffd7ce60 cpplint: add --quiet flag to suppress all output when there's no errors
Example:

   cpplint.py --quiet <file-names>

Will now return with an exit code of 0 and return empty output if there
were no errors. This makes it particularly useful to be driven by a build system
such as makefiles or gradle.

In particular, these messages are now suppressed:

  Ignoring <filename>, excluded by CPPLINT.cfg, ...
  Done processing <filename>
  Total errors found: 0

If there were any errors, the above messages are printed nevertheless.

There is no behavior change if --quiet is not passed in.
2017-11-10 14:23:35 -08:00
Igor Murashkin 8a87a46cc7 CPPLINT.cfg root=setting is now relative to CFG file.
Also further improve the documentation and testing around --root.

Previously the root=setting in the CFG file was treated identically
to passing --root=setting on the command line, which seems undesirable
since it depends on were cpplint.cfg was invoked from (for relative
paths).

Judging on settings such as 'exclude_files' it seems within the spirit
to make the settings 'current working directory' contextual to the
same directory that CPPLINT.cfg is in.

This also makes execution consistent (picking up the "correct" settings)
regardless of the CWD when executing cpplint.py.

Example:

  echo 'root=..' >> /a/b/c/CPPLINT.cfg
  cd /
  cpplint.py /a/b/c/source_file.h
  # expects header guard of C_SOURCE_FILE_H_

However the old behavior would use '/../' = '/'
and incorrectly think the root was 'A_B_C_SOURCE_FILE_H_'.
2017-11-09 16:36:27 -08:00
Igor Murashkin e7ddd2af62 cpplint --root: support non-subdirectories
Using cpplint.py --root with directories at a more outer level
will now prepend the header guard with all the directories from the
root to the file.

For example given

  ls /a/b/c # /a/b/c/.git /a/b/c/filename.h
  cpplint.py --root=/a/b /a/b/c/filename.h   # C_FILENAME_H_

  # no root behavior:
  cpplint.py /a/b/c/filename.h               # FILENAME_H_

Also supports relative paths:

  cd /a/b/c
  cpplint.py --root=.. filename.h            # C_FILENAME_H_

Note that the old usage is still supported:

  cd /a/b/c
  mkdir -p d/e/f
  touch /a/b/c/d/e/f/filename.h
  cpplint.py --root=d/e/f d/e/f/filename.h   # FILENAME_H_

which would "strip" the prefix rather than prepend an extra prefix.

(Invalid root prefixes are as before also ignored)
2017-11-08 14:33:52 -08:00
Elliot Glaysher 6c8669edb2 Fix test regression from 9883c51578. 2017-07-28 14:54:33 -07:00
Clemens Hammacher 9883c51578 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 also removes the presubmit check that checked that the
macros are only used in the private declarations.
2017-07-24 12:57:05 +02:00
schoetbi 819c572b4c Changed vs7 output format so that Visual Studio can parse the error messages correctly
Also Visual Studio can jump to the correct file/linenumber
2017-05-03 10:11:03 +02:00
Dana Jansens 2db65fed51 Add unit tests for constexpr constructors
This also adds unit tests for inline+explicit constructors being okay,
with and without constexpr.
2017-03-02 13:20:12 -05:00
Dana Jansens cf4071cf5d 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.
2017-02-22 12:02:39 -05:00
Elliot Glaysher ae11811f81 Revert "Fix the `cpplint.py` `build/endif_comment` check." 2016-09-30 15:34:26 -07:00
Elliot Glaysher aa8ccb418c Merge pull request #184 from LukeCz/stdout
Cpplint is unnecessarily polluting stderr
2016-09-29 11:03:52 -07:00
LukeCz e09f478aa8 Cpplint is unnecessarily polluting stderr 2016-09-28 19:13:37 -05:00
LukeCz 8920b13221 Changes after review 2016-09-26 19:40:47 -05:00
LukeCz 7197a244ea Configurable header extensions
Fix for #50, #79 and  #113
2016-09-24 13:27:35 -05:00
Alexandre Rames f558944179 Fix the `build/endif_comment` check.
- The check needs to be run before we remove comments, otherwise valid
  lines will be found as invalid.
- A single character different from `/` after the spaces is enough to
  indicate an error.
- Also catch errors when only one `/` is present.
  (For example `#endif / MY_FILE_H`.)
2016-09-21 11:03:34 +01:00
Elliot Glaysher 6d3a7d8a22 Merge pull request #159 from lhchavez/cpp11
Support C++11 types in build/include_what_you_use
2016-07-13 10:20:40 -07:00
lhchavez 2890dffc1f Support C++11 types in build/include_what_you_use
This change adds support for forward, make_pair, make_shared,,
make_unique, move, shared_ptr, unique_ptr, unordered_map,
unordered_multimap, unordered_multiset, unordered_set, weak_ptr.
Closes #133.
2016-07-11 19:37:29 -07:00
lhchavez 3ae81f1911 Make build/include_what_you_use more consistent
`std::string` has some logic to omit the suggestion if it is used in
non-STL namespaces, so the same check should be OK to use for other
types. Closes #157.
2016-07-11 19:00:34 -07:00
Elliot Glaysher 01f0f704f7 Merge pull request #129 from gueraf/gh-pages
CppLint: Make "root" flag configurable via CPPLINT.cfg
2016-06-30 13:32:23 -07:00
Elliot Glaysher 450aa460ec Merge pull request #139 from Nazg-Gul/root_windows_fix
Fix regex escape issue when using --root on Windows
2016-06-30 13:20:33 -07:00
Piotr Semenov a3c36d93d2 [FEATURE] Adds the unit-test for case "NOLINT, NOLINTNEXTLINE works for };". 2016-06-30 11:45:37 +03:00
Piotr Semenov b7e2ef6de2 [FIX] Bug: NOLINT, NOLINTNEXTLINE has no effect for "};". 2016-06-30 11:44:21 +03:00
Sergey Sharybin 3b0ea894c1 Fix regex escape issue when using --root on Windows
The code was using directory separator in the regex itself,
which means on Windows it was leaving unescaped backslash.

Added explicit escape for such cases.
2016-05-31 00:21:14 +02:00
Alex Vakulenko 01e47236c8 Update cpplint.py to r456
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.
2016-05-06 14:10:17 -07:00
Fabian Guera 2322e4ffaa
Make "root" flag configurable via CPPLINT.CFG 2016-05-01 17:36:30 +02:00
Ackermann Yuriy b545d7f67f Reverted to non-markdown and applyed HTTPS fix. 2016-04-27 14:06:21 +12:00
Ackermann Yuriy 7969290bac Replaced HTTP where HTTPS been awailable. 2016-04-01 21:41:34 +13:00
Dirk Thomas 79ea3810bb update link to point to github instead of googlecode 2015-10-13 15:58:53 -07:00
avakulenko@google.com 554223dc54 Update cpplint.py to #409
409 - Fixed false positive for access-specifier used with virtual in inheritance.
408 - Fixed false positive in determining rvalue parameter types for functions
      whose return type is on the previous line.
407 - Allow different include sections to be separated by anything other than
      #include.
406 - Disable readability/streams warnings in cpplint, to reflect style guide
      changes.
405 - Fixed false positive for whitespace checks with CUDA code.
404 - Do not issue cpplint warnings for use of Doxygen-style comments.
403 - Allow RValue types that were listed in template-argument-list.
      Fixed handling of RValue types after pointer parameters.
402 - Change the style guide to allow std::forward and associated use of rvalue
      references.
401 - Fixed cpplint crash when checking header guards for filenames containing
      meta characters.
400 - Fixed false positive for alignas() used with anonymous struct or union.
399 - Fixed false positive for template function calls with braced constructor.
398 - Allow #endif header guard comments to use "/**/" style if there are no
      "//" comments in the same file.
397 - Fixed false positives for DISALLOW macro check position check.
396 - Don't treat lambda functions with return value syntax as casts.
395 - <skipped>
394 - Fixed RValue references for out-of-line inner class constructor
      declarations.
393 - Fixed false positive for redundant override/final by ignoring declarators.
392 - Fixed false positive for taking address of a function pointer return value
      being recognized as taking address of a cast.
391 - Version of cpplint that fixes the spacing around the '=' operator.
390 - <skipped>
389 - Don't warn on non-const reference arguments of out-of-line method
      definitions.
388 - Fixed false positive for "virtual" from virtual base class be interpreted
      as virtual member function.

R=erg@google.com

Review URL: https://codereview.appspot.com/184990043
2014-12-04 22:00:20 +00:00
avakulenko@google.com 310681b865 Added support for 'linelength' setting in CPPLINT.cfg
It is now possible to override the line length per project
by usign 'linelength' setting in CPPLINT.cfg.

R=erg@google.com

Review URL: https://codereview.appspot.com/132050043
2014-08-22 19:38:55 +00:00
avakulenko@google.com a8ee7eaaa4 Update cpplint.py to #387:
387 - Allow lint warnings on the next line to be suppressed with NOLINTNEXTLINE.
386 - Fixed false positive for strcat and strcpy.
385 - Fixed false positive for bitwise and on last line of a multi-line
384 - Remove unused deprecated testing/base/googletest.h header.
383 - Fixed false positive for bitwise and on last line of a multi-line
      initializer list that ends with closing brace on the same line.
382 - Allow header guard warning to be silenced with
      "// NOLINT(build/header_guard)" comment.
381 - Removed check for spaces between "//" and "TODO".
380 - Fix typo: Redudnant -> Redundant
379 - Added check for redundant "virtual" and "override" function-specifier.
378 - Updated missing "explicit" message to match style guide wording
377 - Add cpplint check to prevent .cc file inclusions from other packages.
      These are generally bad and we should prevent regressions like this until
      proper BUILD layering checks are in place.
376 - Silence missing braces warning for conditional statements inside lambdas.
375 - Warn about multi-arg constructors being explicit only at highest severity
      level.
374 - Warn about non-single-argument constructors marked explicit.
373 - Exclude 'case' from function spacing check.
372 - Exclude third party headers such as Python.h from these checks:
371 - Fixed false positive for function pointer parameters followed by other
      parameters.
370 - Allow RValue reference for default inline constructor.
369 - Fixed false positive for array of references and operator,().
368 - Silence named parameter warning for macros.
367 - Fixed false positive for duplicate header warning across preprocessor
      boundaries.
366 - Allow rvalue references for constructors and assignment operator.
365 - Stop handling DISALLOW_EVIL_CONSTRUCTORS in cpplint.py,
      since it's going away.
364 - Fixed false positive for member function in nested classes.
363 - Namespace indentation for cpplint. The C++ style guide enforced that items
      within a namespace do not receive an extra level of indentation.
362 - Fixed false positive for multi-line member functions returning strings.
361 - Do not suggest replacement CHECK macros if custom error messages are used.
360 - Silence nonconst reference warning for multiline derived functions.
359 - Silence non-const reference warnings for derived functions.
358 - Added link to developer guide.
357 - Remove the partial ban on std::move and related features. More general
356 - Fixed false positive for << inside macros.
355 - Make _NestingState class public.
354 - Fixed false positive for multiline function templates.
353 - Fixed false positive for lambda capture.
352 - Silence RValue reference warnings that are enclosed in a
351 - Do not warn on CR-LF lines if all input lines are uniformly CR-LF.
350 - Tweaked the error messages for static mutex with default constructors.
349 - Fixed false positive for unnamed parameters in macros.
348 - Recognize &&... as RValue references.
347 - Use alternative error message for including <ostream>.
346 - Fixed false positive for function style template argument.
345 - Fixed false positive for braced constructor call inside brackets.
344 - Minor spelling and grammar fix.
343 - Fixed false positive for non-const reference check inside constructor
342 - Fixed cases where rvalue references are not identified correctly:
341 - Check that third party header files have some header guard, but do not
340 - Don't check header guards in third party files.
339 - Instead of treating thread annotations as macro function calls, skip over
      them in parsing function signatures.  This silences false positives for
      lambdas with thread annotations.
338 - Fixed false positive for deprecated cast where return type of function
337 - Fixed false positive for alias-declarations of function pointers.
336 - Improved error message for taking address of something dereferenced
335 - Added support for C++14 digit separators.
334 - Silence long line warnings for JNI.
333 - Fixed false positive for constructor calls for rand{} being
332 - Elide C++11 raw strings as an empty quoted string instead of
331 - Split up long functions in cpplint.py and cpplint_unittest.py
330 - Fixed false positive for missing space check around "using operator;"
329 - Fixed false positive for indent check around multi-line raw strings.

R=erg@google.com

Review URL: https://codereview.appspot.com/125980043
2014-08-11 19:41:35 +00:00
erg@google.com 7430eefe76 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.

Patch by avakulenko@google.com.
Related CL: https://codereview.chromium.org/406373002/

Review URL: https://codereview.appspot.com/115340043
2014-07-28 22:33:46 +00:00
avakulenko@google.com 4b957b2edd Restore the accidentally deleted extra_check_functions in cpplint.py
This extra parameter was used when calling cpplint.ProcessFile
directly from depot_tools/gcl.py and depot_tools/git_cl.py.

Restoring it...

R=erg@google.com

Review URL: https://codereview.appspot.com/105820044
2014-06-04 22:48:14 +00:00
avakulenko@google.com 02af6281c6 Update cpplint.py to #359:
359 - Silence non-const reference warnings for derived functions.
357 - Remove the partial ban on std::move and related features.
      More general use of rvalue references is still banned for now.
356 - Fixed false positive for << inside macros. Also recognize implicit
      constructors of the form "Type(Type&& param)".
355 - Make _NestingState class public. Also adds a new method
      NestingState.InAsmBlock, which returns true if the top of the stack
      is a block containing inline ASM.
354 - Fixed false positive for multiline function templates.
353 - Fixed false positive for lambda capture.
352 - Silence RValue reference warnings that are enclosed in a
      GOOGLE_ALLOW_RVALUE_REFERENCES_(PUSH|POP) range.
351 - Do not warn on CR-LF lines if all input lines are uniformly CR-LF.
349 - Fixed false positive for unnamed parameters in macros.
348 - Recognize &&... as RValue references.
347 - Use alternative error message for including <ostream>.
346 - Fixed false positive for function style template argument.
345 - Fixed false positive for braced constructor call inside brackets.
344 - Minor spelling and grammar fix.
343 - Fixed false positive for non-const reference check inside constructor
      initializer lists.
342 - Fixed cases where rvalue references are not identified correctly:
      - Parameter in a templated function.
      - Parameter for a single-arg constructor.
      - Return type in a templated function.
338 - Fixed false positive for deprecated cast where return type of
      function template is const.
337 - Fixed false positive for alias-declarations of function pointers.
336 - Improved error message for taking address of something dereferenced
      from a cast.
335 - Added support for C++14 digit separators
      (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf).
      Not sure if the style guide would allow this feature or not, but
      cpplint must recognize these one way or another to provide accurate
      error messages.
333 - Fixed false positive for constructor calls for rand{} being
      identified as calls to rand().
332 - Elide C++11 raw strings as an empty quoted string instead of an empty
      string.  This allows us to differentiate blank lines inside raw
      strings from regular blank lines.
331 - Split up long functions in cpplint.py and cpplint_unittest.py.
      This is a refactoring change with zero change in functionality,
      the goal is to clean up new warnings.
330 - Fixed false positive for missing space check around "using operator;"
329 - Fixed false positive for indent check around multi-line raw strings.
328 - Added check missing spaces around ||.  This check should have been
      included in the original CheckSpaces. Added check for &&, and output
      message for missing space or rvalue reference according to context.
327 - Fixed false positive for alias-declaration.
326 - Improved accuracy of matching parentheses and angle brackets.
      Previously, if cpplint was trying to match () pairs, those two
      characters are the only things that it looked for. This worked
      reasonably well for everything except <>, which is easily confused
      with operators.  This change takes all other parentheses into account,
      and do not count <> characters as angle brackets if they are inside
      other parenthesized expressions.
325 - Fixed handling of multiple raw strings on the same line.
324 - Better enforcement that braces are used either around all branches of
      the condition, or none. Checks for what seem to be multiple statements
      in an single-line if/else body. Checks for ambigous if/if/else nesting
      without braces.
323 - Fixed false positive for extra space in returning lambdas.
322 - Fixed false positive for tokens with "else" prefix being treated as
      else keyword following a conditional block.
321 - Fixed false positive for placement new being treated as deprecated cast.
320 - Change lint so it no longer warns about use of std::function and related
      features (bind, placeholders) now that function/bind is no longer banned.
319 - Fixed false positive for alignof and alignas being recognized as casts.
318 - Permit std::shared_ptr, std::weak_ptr and std::enable_shared_from_this.
317 - Silence deprecated cast warning for templates using function types as
      the first argument
316 - Remove aligned_storage from the list of blacklisted C++11 features.
315 - Fixed false positive for casting to pointer types.
314 - Do not warn about single-arg constructors with std::initializer_list<>
      not marked as explicit.
313 - Remove lint errors when including <atomic>.
312 - Fixed incorrect parsing of multiple block comments on the same line.
311 - Fixed nesting state parser for classes in template argument list.
310 - Fixed false positive for semicolon after brace for lambdas where there
      is a newline between lambda-introducer and lambda-declarator.
308 - Fixed false positive for global string pointers being treated as string
      values.
307 - Modify cpplint to follow updated style guide on comments in braced
      initializer lists. In particular, don't warn about missing spaces
      if the comment is aligned with the next line.
306 - Fixed false positive for brace initializer list in ternary expression.
305 - Fixed false positive for blank line at start of code block due to elided
      raw string contents.
304 - Add a cpplint.py warning for default captures in lambda expressions.
303 - Recognize unordered_map and unordered_set.
302 - Fixed false positive for trailing semicolons when lambda-capture spans
      multiple lines.
301 - Fixed false positive for trailing semicolon following lambdas.
300 - Fix raw string handling when the next raw string begins on the same line
      that the previous raw string ends.
299 - Fix false C-style cast detection due to trailing "override".
298 - Fix false positive for requiring an argument name in a GMock declaration.
297 - Fixed false positives for blank line warnings near 'extern "C"' blocks.

R=erg@google.com

Review URL: https://codereview.appspot.com/108730043
2014-06-04 18:53:25 +00:00
erg@google.com 1968027290 Add an --extensions flag to change valid file extensions.
The valid cpplint extensions are .h, .cpp, .cc, .cuh and .cu. It is
common for .hpp to be a valid extension to check, the --extensions flag
allows the user to specify which extensions they think are valid.

Patch by Matt Clarkson <mattyclarkson@gmail.com>
2013-12-16 22:48:54 +00:00
erg@google.com 0075d1469a A false positive occurs when a user specifies a using declaration for a stream operator:
10: using ns::operator<<;
    file.cpp:10: Missing spaces around << [whitespace/operators] [3]

The regular expression has been updated to find this valid use case of the <<
text string.

Review URL: https://codereview.appspot.com/22190043

Patch from Matt Clarkson <mattyclarkson@gmail.com>.
2013-11-05 22:28:07 +00:00
erg@google.com ab53edf6ff Added a --linelength flag so that the default of 80 can be changed.
Review URL: https://codereview.appspot.com/22180043

Patch from Matt Clarkson <mattyclarkson@gmail.com>.
2013-11-05 22:23:37 +00:00