[Solved]-Quieting pylint false-positives when using django

7👍

Easiest, provided your problematic code is not out of your control (e.g. autogenerated), is to disable the complaints in the areas you know they’re spurious. Copying an example straight out of the message that first introduced this solution:

1  class foo:
2    # pylint: disable=W1234
3    def bar(self):
4      # pylint: disable=W4321
5      pass
6    def gnurz(self):
7      pass

7👍

I don’t like repeating myself, but here is an answer that actually works:
https://stackoverflow.com/a/31000713/78234
From the answer:
Do not disable or weaken Pylint functionality by adding ignores or generated-members.
Use an actively developed Pylint plugin that understands Django.
This Pylint plugin for Django works quite well:

pip install pylint-django

and when running pylint add the following flag to the command:

--load-plugins pylint_django

Detailed blog post here.

5👍

if you do not care some pylint’s warnings, like unexistent member(E1101) and too many public methods(R0904), you can easily close it with:

pylint --disable=E1101,R0904

if you are interested with few checkers only, you can run pylint like this:

pylint --enable=basic,variables,classes,design,imports,newstyle,exceptions,format,miscellaneous,metrics,similarities

Leave a comment