How to Disable Specific Pylint Checks

Suppose you’re working on a Python application and using Pylint to monitor code quality, you may come across specific lines in code where you do not want Pylint to check. Here’s how you disable such check.

Add a comment of the form:

# pylint: disable=some-error-attribute

To re-enable checks within the same function, you can use a comment like

# pylint: enable=some-error-attribute

You may place the disable comment just able the block of codes you want to disable checks for and any code after that line in the function will not be checked for the attribute. You can also place the comment just after the code on the same line so it acts only on that line.

The Pylint documentation [1] has a lot more information and examples on these.


1. Messages control — Pylint 1.7.0 documentation. [08/03/17].

Leave a Reply

Your email address will not be published. Required fields are marked *