15

When running cpplint, I run into some warnings that I'd like to completely disable. Specifically the copyright message & whitespaces:

range.h:0: No copyright message found. You should have a line:

"Copyright [year] " [legal/copyright] [5]

range.h:10: At least two spaces is best between code and comments

[whitespace/comments] [2]

How do I accomplish this? Ideally would be modifying the CPPLINT.cfg file, but I would take an inline comment or a command line flag. I can't find any documentation on disabling rules.

Community
  • 1
  • 1
AnilRedshift
  • 7,937
  • 7
  • 35
  • 59
  • 2
    It looks like there's some mechanism for disabling rules, but again I don't see any documentation =/ https://github.com/google/styleguide/blob/gh-pages/cpplint/cpplint.py#L603 – AnilRedshift Aug 14 '17 at 05:25
  • 2
    @Someprogrammerdude no I clearly just linked a line to the source code without trying to understand it. cpplint --help word vomits 180 lines of stuff. And yes, I did try that. Somehow I missed it. It happens. Your rush to judgement is pretty unkind, in my opinion. You might consider trying to be inclusive in your responses. – AnilRedshift Aug 14 '17 at 05:56

1 Answers1

22

You can configure filters in CPPLINT.cfg:

filter=-whitespace,-legal/copyright
Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • 4
    For anyone trying to work out where to get the list of filters, the commandline usgae message says: To see a list of all the categories used in cpplint, pass no arg: `cpplint --filter=` – Ed Bordin May 20 '19 at 05:45
  • Is there a way to specify filters via a comment at the top of the file so they are in effect throughout that whole file? We get tons of lint errors from using some 3rd party macros, e.g. `MATCHER_P` from Google Mock. – user9645 Dec 10 '21 at 15:45