Disable specific warnings from cpplint
Asked Answered
L

1

17

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.

Ladylike answered 14/8, 2017 at 5:18 Comment(2)
It looks like there's some mechanism for disabling rules, but again I don't see any documentation =/ github.com/google/styleguide/blob/gh-pages/cpplint/…Ladylike
@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.Ladylike
G
24

You can configure filters in CPPLINT.cfg:

filter=-whitespace,-legal/copyright
Guerin answered 14/8, 2017 at 5:29 Comment(2)
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=Swahili
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.Defile

© 2022 - 2024 — McMap. All rights reserved.