Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable all Pylint warnings for a file

Tags:

python

pylint

We are using Pylint within our build system.

We have a Python package within our code base that has throwaway code, and I'd like to disable all warnings for a module temporarily so I can stop bugging the other devs with these superfluous messages. Is there an easy way to pylint: disable all warnings for a module?

like image 812
mvanveen Avatar asked Apr 19 '12 23:04

mvanveen


People also ask

How do I disable 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 I skip a Pylint check?

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.

What is Pylintrc file?

If the current working directory is in a Python module, Pylint searches up the hierarchy of Python modules until it finds a pylintrc file. This allows you to specify coding standards on a module-by-module basis.


1 Answers

From the Pylint FAQ:

With Pylint < 0.25, add

# pylint: disable-all 

at the beginning of the module.

Pylint 0.26.1 and up have renamed that directive to

# pylint: skip-file 

(but the first version will be kept for backward compatibility).

In order to ease finding which modules are ignored a information-level message I0013 is emitted. With recent versions of Pylint, if you use the old syntax, an additional I0014 message is emitted.

like image 62
enderskill Avatar answered Oct 16 '22 12:10

enderskill