Search code examples
pythondjangopylint

How do I hide Pylint 1.2.1 error output when using Django?


I am attempting to integrate pylint into our local project that uses Django (1.6.1), and I had it working with Pylint 0.27.0, but now that I've updated to the latest 1.2.1 some new errors are popping up and I can't seem to get them to go away.

Here's the nature of the error:


from django.db import models

class UserData(models.Model):
    # data...
    fieldA  = models.IntegerField(default=0)
    fieldB  = models.IntegerField(default=0)

# ...

x = UserData(fieldA=1, fieldB=2)
# The above line of code generates errors:
# Unexpected keyword argument 'fieldA' in constructor call (unexpected-keyword-arg)
# Unexpected keyword argument 'fieldB' in constructor call (unexpected-keyword-arg)
# No value for argument 'name' in constructor call (no-value-for-parameter)
# No value for argument 'bases' in constructor call (no-value-for-parameter)
# No value for argument 'attrs' in constructor call (no-value-for-parameter)

I've tried getting around this by editing the file during pylint checking, using something like this:

UserData.__init__ = lambda self, *args, **kwargs: None

But Pylint still prints out the same errors. I also tried directly adding the constructor call to the UserData object, but still no luck.

Is there any way I can modify the code or the pylint settings to quiet these errors? Preferably without hiding those errors for the entire project.


Solution

  • Starting from pylint version 1.4, these errors are no longer generated for Django.