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

StackOverflow https://stackoverflow.com/questions/21487025

  •  05-10-2022
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top