Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With pylint 1.5.0, astroid 1.4.1, pylint-django 0.7, 'get' is not recognised #53

Closed
jribbens opened this issue Dec 3, 2015 · 6 comments

Comments

@jribbens
Copy link

jribbens commented Dec 3, 2015

The following test script produces an error when linted and it seems to me that it should not:

"""Test case."""
from django.contrib.auth.models import User
User.objects.get(email="hello", password="there")

E: 3, 0: Instance of 'UserManager' has no 'get' member (no-member)

(This is with Python 3.4.3, Django 1.8.7.)

@nedbat
Copy link

nedbat commented Dec 21, 2015

I am seeing many more no-member violations with pylint==1.5.2, astroid==1.4.2, and pylint-django==0.7.1.

I've written them up as a pylint issue: pylint-dev/pylint#754, but perhaps the problem is in the pylint-django plugin?

@kaleb
Copy link

kaleb commented Jan 8, 2016

From the Django Deserialization of Natural Keys example, the following is also problematic:

from django.db import models

class PersonManager(models.Manager):
    # pylint: disable=too-few-public-methods
    # Does pylint not know about subclassing?

    def get_by_natural_key(self, first_name, last_name):
        # pylint: disable=no-member
        # pylint is complaining about no member `get1
        return self.get(first_name=first_name, last_name=last_name)

class Person(models.Model):
    objects = PersonManager()

    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)

    birthdate = models.DateField()

    class Meta:
        unique_together = (('first_name', 'last_name'),)

@mlncn
Copy link

mlncn commented Feb 2, 2016

pylint==1.5.4
django==1.7.10
pylint-django==0.7.1
astroid==1.4.4

Just started using pylint-django, updated pylint to be able to do so, it helped with a great many spurious warnings but as noted above, am now getting frequent nomember ones like these:

Instance of 'Reporter' has no 'save' member (no-member)
Super of 'ReporterCategory' has no 'save' member (no-member)
Instance of 'ReporterManager' has no 'get_queryset' member (no-member)
Instance of 'ReporterManager' has no 'filter' member (no-member)

Which is all to say subscribing, interested in helping.

@iXce
Copy link
Contributor

iXce commented Mar 13, 2016

As I faced this problem as well I tried to use different versions of pylint/astroid, and ended up using the git master version of both of them (pylint-dev/pylint@9e7bee0 and pylint-dev/astroid@7278409).

I then patched pylint-django (https://github.com/iXce/pylint-django) for:
a) compatibility with the new api for locals in pylint/astroid: 73326fa
b) considering ForeignObject as an alias of Member (for use with OneToOneFields): f4bcf7d
c) missing Model/Manager members: 0356359

I'm totally unsure if this was the best way to do it, but this combination of versions works very well for me at the moment =) Hope it can help someone ! And if these approaches are decent, I can do a pullrequest.

@jribbens
Copy link
Author

@carlio Any chance of getting this issue fixed, given that this whole module is essentially broken currently?

@nedbat
Copy link

nedbat commented Mar 24, 2016

@iXce Please make a pull request. I'm not in a position to merge it (just a user, not committer), but it will help move this along.

atodorov added a commit that referenced this issue Jan 18, 2018
this is needed because of how we run tests and because of many
internal updates to pylint itself
atodorov added a commit that referenced this issue Jan 18, 2018
this is needed because of how we run tests and because of many
internal updates to pylint itself
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants