Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pylint: "locally defined disables" still give warnings. How to suppress them?

Tags:

pylint

I work with a software framework which has a couple of classes with method names containing capital letters (due to C++ wrappers). This is of course not PEP8 and pylint shows the corresponding error C0103. I also added C0111 to the list to ignore the missing docstrings for some methods, like this:

def Configure(self): # pylint: disable=C0103,C0111

It works, however now I get warnings because of the local disablings:

Class: I0011 -> locally disabling C0103
Class: I0011 -> locally disabling C0111

How should I suppress them?

like image 431
tamasgal Avatar asked Jan 31 '14 18:01

tamasgal


People also ask

How do you stop Pylint warnings?

This may be done by adding # pylint: disable=some-message,another-one at the desired block level or at the end of the desired line of code.

How do you ignore Pylint?

you can ignore it by adding a comment in the format # pylint: disable=[problem-code] at the end of the line where [problem-code] is the value inside pylint(...) in the pylint message – for example, abstract-class-instantiated for the problem report listed above.

How do I know if a Pylint is ignoring a file?

If you want to disable specific warnings only, this can be done by adding a comment such as # pylint: disable=message-name to disable the specified message for the remainder of the file, or at least until # pylint: enable=message-name .


1 Answers

OK, so obviously one has to ignore the ignore-warning explicitly. One can do this in the pylint config file: if you don't have one, simply generate a standard configuration via

pylint --generate-rcfile > pylint.rc

and uncomment the line with disable=... and add I0011 to the list. This suppresses all warnings regarding "locally defined disablings".

The other method is to add the following line to the beginning of a file (or block, whatever), if you don't want to suppress the warning globally:

#pylint: disable=I0011
like image 193
tamasgal Avatar answered Oct 14 '22 22:10

tamasgal