Commit Graph

33 Commits

Author SHA1 Message Date
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
erg@google.com
6d8d983b11 In cpplint, permit Dodxygen C++ annotations, which come after members, e.g.
int var; //!< Brief description after the member
or
  int var; ///< Brief description after the member

Cf. http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html#memberdoc

Currently, cpplint accepts comments after members, cf.
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Implementation_Comments#Implementation_Comments
and it accepts also the doxygen comments of the type "///" (followed by a new line) and
"/// " (followed by a comment). Only the Doxygen annotations, which come
after members are rejected, which is fixed by this patch.

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

Patch from Tobias Burnus <burnus@net-b.de>.
2013-10-31 19:46:18 +00:00
erg@google.com
2aa5998d82 Update cpplint.py to #296:
- Check for NUL bytes in the file.
- Fixed many false positives related to brace initialization.
- Improved accuracy of parsing reference template parameters.
- Added support for C++11 raw strings.
- Added CUDA extensions to those allowed by cpplint.
- Added check for incomplete namespaces.
- Silence warnings for missing spaces after comma due to elided
  comments.
- Rephrased some messages so that they're actionable.
- Fix false positive on namespace qualified function pointer arguments.
- Fix false positive for operators which return strings.
- Revive the VLOG check.

R=mark@chromium.org

Review URL: https://codereview.appspot.com/17450043
2013-10-28 19:09:25 +00:00
erg@google.com
c667123215 Update cpplint.py to #267:
- Handle parentheses in CHECK() calls properly.
- Fixed multiple false positives where various things like
  std::fucntion<> or function pointers were being mistaken for casts.
- Fixed whitespace warning on placement new.
- Fixed multiple false positives related to const references.
- Added warning for empty conditional bodies.
- Stop advising the use of readdir_r instead of readdir.
- Fixed false positive for empty macro arguments.
- Fixed false positvie for braced initializer lists.
- Don't warn about unnamed parameters in function pointers.

R=mark@chromium.org

Review URL: https://codereview.appspot.com/17400043
2013-10-25 21:44:03 +00:00
erg@google.com
fd5da63478 Update cpplint.py to #242:
- Check indentation of public/protected/private keywords.
- Remove RTTI warning.
- Silence warning about multiple inheritance from global namespace.
- Copy ctors don't need "explicit".
- Understand "const char* const&" as a const reference.
- Remove runtime/sizeof.
- Recognize the "catch" keyword.
- List C++11 headers
- Allow sscanf()
- Allow for one extra level of nesting in template class decls.
- False positive for semicolons after single-line nameless unions.

R=mark@chromium.org

Review URL: https://codereview.appspot.com/15740044
2013-10-25 17:39:45 +00:00
erg@google.com
5d00c5679e Adding streambuf as a valid CPP header.
Patch from chris.dale.dis.
2013-07-12 19:57:05 +00:00
erg@google.com
02c27fd836 Added cpplint.py output format for eclipse
Patch by mcasas@chromium.org
CR: https://codereview.chromium.org/16140002/
2013-05-28 21:34:34 +00:00
erg@google.com
4d70a88efd Add --root flag used for deriving header guard CPP variable.
By default, the header guard CPP variable is calculated as the relative 
path to the directory that contains .git, .hg, or .svn. When this flag 
is specified, the relative path is calculated from the specified 
directory.

Patch by mazda@chromium.org
CR: https://codereview.appspot.com/8630045/
2013-04-16 21:06:32 +00:00
erg@google.com
d350fe561e Updated cpplint.py to #224:
- Better emacs-flymake integration
- Fix false  positives in macros and template parameters
- Improve the wording on the make_pair warning
- Remove virtual keyword checks (now a warning in clang)
- Add checks for namespaces
- Check that DISALLOW_* macros are always in the "private:" section
- Fix false positives for gMock
- Check for alternative boolean operator tokens
- Fix false positives for space on parens
- Fix false positives about placement of "{" near preprocessor macros
- Don't lint inside inlined assembler
- Don't warn on "auto"; it is now a type shortcut, not a storage class
- Don't warn on c++11 for loops
- Warn on empty loop bodies
- Don't warn on unnamed args for the postincrement operator
- Fixes for "<" placement now allowed in c++11
Review URL: https://codereview.appspot.com/7039047
2013-01-14 17:51:48 +00:00
erg@google.com
720121a67f Changed the hashband on cpplint.py 2012-05-11 16:31:47 +00:00
erg@google.com
90ecb62a9f Convert windows path seperators to unix like while doing IncludeWhatYouUse.
Review URL: https://codereview.appspot.com/5601049
2012-01-30 19:34:23 +00:00
erg@google.com
dc28970e18 Improve the error message for when #ifndef guards don't match the #define.
Patch from <csharp@google.com>
2012-01-26 20:30:03 +00:00
erg@google.com
3dc7426aed Support svn 1.7 directory structure.
Committing on behalf of Reid Kleckner <rnk@google.com>.
BUG=chromium:102890
2011-11-30 01:12:00 +00:00
erg@google.com
8a95ecca27 Update to #179:
- Suggest "const_cast" when encountering "(char*)".
- Warn on template arguments to make_pair().
- Require <utility> if pair<> is seen now that <map> doesn't include it.
- Warn on lack of "explicit" keyword on single argument inline constructors.
- Better check for hanging ')' when closing function calls.
- Don't warn on: 'int v[1][3] = {{1, 2, 3}};'
- Allow function calls as the first argument to printf().
Review URL: http://codereview.appspot.com/4974066
2011-09-08 00:45:54 +00:00
erg@google.com
efeacdf0fa Add extension mechanisms for custom checks to cpplint.py.
This allows users of cpplint.py to specify additional check functions.

Will be used by: http://codereview.chromium.org/7834045/

Review URL: http://codereview.appspot.com/4950069
Patch from Alexei Svitkine <asvitkine@chromium.org>.
2011-09-07 21:12:16 +00:00
erg@google.com
d7d2747c6c Update cpplint.py to #161:
- ostream should be treated as a system header
- Expand the MockCallback whitelist entry for gMock.
- Virtual destructor check shouldn't get confused with
  "class EXPORT ClassName {" constructs.
- Don't warn about the length of "$ Id: ... $" lines.
- Better semicolon checks in for() loops.
- Better whitespace comment checks.
Review URL: http://codereview.appspot.com/4964064
2011-09-07 17:36:35 +00:00
erg@google.com
8f91ab2835 Reverted r70, at asvitkine's request 2011-09-06 21:04:45 +00:00
erg@google.com
5210aec6df Upstream useful lint check from WebKit's fork of cpplint.py.
Checks against "Foo *bar" and "Foo &bar" declarations.

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

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

Patch committed for asvitkine@chromium.org.
2011-09-06 20:19:05 +00:00
erg@google.com
a51c16b542 Allow blank Doxygen-style comments. Patch by mball@google.com. 2010-11-17 18:09:31 +00:00
erg@google.com
42e59b0ce7 Project prefix directory should work with Hg.
Patch based on one by tomic80.
2010-10-04 22:18:07 +00:00
erg+personal@google.com
0518964d22 Update cpplint.py to #150:
- Be explicit about "class Foo :\n public Bar" being wrong.
- Allow snprintf(NULL, 0, ...) pattern.
- Extend NOLINT syntax.
- Remove NOLINT hint.
- <new> is an STL header.
- Use original filename for header guard when invoked by flymake.
- Avoid false-positive build/include_what_you_use errors for use
  of classes called "string" other than STL ones.

Review URL: http://codereview.chromium.org/1697023
2010-04-30 20:43:03 +00:00
erg@google.com
5e1696994b Check for mercurial checkouts in addition to svn and git.
Patch by Florian Loitsch <floitsch@google.com>
2010-01-28 20:17:01 +00:00
erg@google.com
a868d2d725 Update cpplint.py to #131:
- Optional check to make sure #includes are in alphabetical order.
- Optional "--counting=" option for statistics on what errors were found.
- Fix typos.
- Warn on overloading the unary operator&(). (Binary operator&() is fine).
- Fix false positives on "new int(x)"; it is not a cast.
- Allow "NOLINT" on header guards.
- Prevent members of a class from being "const string&".
2009-10-09 21:18:45 +00:00
erg@google.com
969161cb78 Relicense cpplint under 3 clause BSD for webkit folks.
Review URL: http://codereview.chromium.org/147238
2009-06-26 22:06:46 +00:00
erg@google.com
e35f765fa6 Update cpplint.py to #122:
- Don't check quoted filenames with irrelevant tests.
- Make cpplint accept 'for (foo; bar; ) {}'.
- Work with temporary files generated by Emacs flymake-mode.
- Don't warn on "/// Doxygen comments."
- Check the use of DCHECK in the same way we check the use of CHECK.
- Properly handle relative file paths with IncludeWhatYouUse checking.
- Start checking for IncludeWhatYouUse in a limited way in .cc files.
2009-06-19 20:52:09 +00:00
erg@google.com
3664910272 Update cpplint.py to #114:
- Prevent invalid increment constructs
- Allow long URLs in lines without hitting the 80 char limit
- Prevent false positives of "Extra space after ( in function call" in macro definitions.
2009-03-25 21:18:36 +00:00
erg@google.com
a87abb8b53 Update cpplint.py to #110.
- Allow comments with URLs to exceed the 80 column limit.
- Avoid false positives for "Lint failed to find start of function body"
  test.
- Add checks for transform and min_element.
- Style fixes

Review URL: http://codereview.chromium.org/28056
2009-02-24 01:41:01 +00:00
mmentovai
e2ee45d952 Set svn properties for cpplint 2009-01-15 20:36:30 +00:00
erg@google.com
4e00b9a0d1 Open-sourcing cpplint.py. 2009-01-12 23:05:11 +00:00