GithubHelp home page GithubHelp logo

pylint-django's People

Contributors

aerostitch avatar alejandro-angulo avatar atodorov avatar bittner avatar brymut avatar canarduck avatar carl-tstpd avatar carlio avatar danni avatar dineshtrivedi avatar fadeddexofan avatar federicobond avatar frost-nzcr4 avatar imomaliev avatar ixce avatar jakirkham avatar jpulec avatar mbarrien avatar michael-k avatar mikebryant avatar mohi7solanki avatar naquiroz avatar nijel avatar pierre-sassoulas avatar pre-commit-ci[bot] avatar psrb avatar robinchow avatar sanmai-nl avatar smirolo avatar uy-rrodriguez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pylint-django's Issues

`is_model_meta_subclass` doesn't detect subclasses of `Model` subclasses

Define the following models:

class FooModel(models.Model):
...
    class Meta:
        abstract = True

class BarModel(FooModel):
    ...
    class Meta:
        ....

Then, enable pylint-django and run pylint on a module including these models.

Expected result: C1001, W0232, R0903 disabled for BarModel.Meta.

Actual result: pylint messages as if pylint-django weren't included (but messages for Meta on models inheriting directly from models.Model are suppressed as expected)

Warn if Django is not on the system path

If Django is not available, then lots of the type inference fails and the plugin is pretty hamstrung.

A pylint error should be raised to indicate that Django could not be found.

Note that this is preferable to using warnings.warn as outputting directly to std_err or std_out causes problems for formatting in the 'upstream' tools.

tests: ManyFieldsForm: Module 'django.forms' has no 'IPAddressField' member

Hi, I've got that here with 0.7.1:

$ PYTHONPATH=. python test/test_func.py 
..................F
======================================================================
FAIL: test_functionality (pylint.testutils.LintTC)
file test of input file "func_noerror_form_fields" (LintTC)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pylint/testutils.py", line 323, in test_functionality
    self._test(tocheck)
  File "/usr/lib/python2.7/dist-packages/pylint/testutils.py", line 298, in _test
    self._check_result(self.linter.reporter.finalize())
  File "/usr/lib/python2.7/dist-packages/pylint/testutils.py", line 282, in _check_result
    got.strip()+'\n')
AssertionError: '\n' != "E: 24:ManyFieldsForm: Module 'django.forms' has no 'IPAddressField' member\n"
- 
+ E: 24:ManyFieldsForm: Module 'django.forms' has no 'IPAddressField' member
----------------------------------------------------------------------
Ran 19 tests in 2.952s

The build Django is 0.9.1 (IPAdressFiled dropped?).

Thanks,
DS

HttpResponse

Django test suites using self.client.get or self.client.post return HttpResponse, HttpResponseNotFound, HttpResponseServerError, HttpResponseRedirect, or WSGIRequest.

If you want to test the url of a HttpResponseRedirect you can check its url member.

response = self.client.get(reverse(views.index))
self.assertEqual(response.status_code, 302)  # Not logged in, redirected to login
self.assertEqual(response.url, reverse('login'))

It works fine and the third line is not executed unless response is HttpResponseRedirect. You could also add
self.assertEqual(response.class, HttpResponseRedirect)

but in both cases pylint returns

p1/tests.py:47: [E1101(no-member), P1Tests.test_index] Instance of 'WSGIRequest' has no 'url' member
p1/tests.py:47: [E1101(no-member), P1Tests.test_index] Instance of 'HttpResponseServerError' has no 'url' member
p1/tests.py:47: [E1101(no-member), P1Tests.test_index] Instance of 'HttpResponseNotFound' has no 'url' member
p1/tests.py:47: [E1101(no-member), P1Tests.test_index] Instance of 'HttpResponse' has no 'url' member

any idea how to get rid of these errors?

I could add 'url' to 'generated-members' and the errors would disappear but it is not a good solution.

_id member not detected

Sample code:

class A(Model):
    x = IntegerField()

class B(Model):
    a = ForeignKey(A)
    y = IntegerField()
    def doSomething(self):
        self.y = self.a_id

This causes the error "Instance of 'B' has no 'a_id' member". Looks like the implicit _id members are not detected by pylint-django.

ImageField and FileField transforms are incomplete

Currently only url and name attributes are being exposed to pylint through the transforms, however since under the covers these Fields are really instances of FieldFile and ImageFieldFile at runtime there are many more attributes that are needed such as the File operations, etc.

To resolve this locally I did the following within the django_db_models_fields_files.py transform definition which I think should be suitable as a solution here without having to enumerate all attributes exhaustively:

try:
    from django.db.models.fields.files import FieldFile, ImageFieldFile
except ImportError:
    FieldFile = object
    ImageFieldFile = object


class FileField(FieldFile):
    pass


class ImageField(ImageFieldFile):
    pass

_meta is official API

With _meta being brought into the public API, it makes sense to exclude it from protected-access.

No name 'models' in module 'django.db'

Without the pylint_django plugin, pylint is silent on the line:

from django.db.models import Q

With it, pylint gives the error:

[no-name-in-module] No name 'models' in module 'django.db'

Foreign key related name producing no-member error message when using first() and last()

Code such as the following isn't currently filtered by pylint-django, and so results in a no-member error message in pylint:

<model>.<related_name>.first()
<model>.<related_name>.last()

(Django 1.6 was the version where first() and last() were added to the queryset API)

Fixing this would just seem to require adding the items 'first' and 'last' to the manager_attrs list. Would that be possible, or are the words 'first' and 'last' considered too generic and a risk for false positives?

Pylint should not complain of django constants

in urls.py I get:
pylint: invalid-name / Invalid constant name "urlpatterns"

When using register = template.Library() for a template tag I get:
pylint: invalid-name / Invalid constant name "register"

I know I can add comment in code to ignore this but it would be better if support would be built in pylint.

ugettext_lazy('').format

Thanks for this great extension.
Currently pylint with pylint-django returns error pylint: [no-member] Instance of '__proxy__' has no 'format' member for something like ugettet_lazy('').format.
I fixed it by changing ugettext_lazy = lambda x: None to ugettext_lazy = lambda x: '' in file pylint_django/transforms/transforms/django_utils_translation.py. Is it alright?

'Module' object has no attribute '_locals'

And seems like it's happening because of this import

from django.utils.translation import ugettext_lazy as _

Here's the traceback:

File "/..../lib/python3.4/site-packages/astroid/manager.py", line 337, in transform
ret = transform_func(node)
File "/..../lib/python3.4/site-packages/pylint_django/transforms/init.py", line 29, in set_fake_locals
module._locals[class_name] = fake._locals[class_name] # pylint: disable=protected-access
AttributeError: 'Module' object has no attribute '_locals'

Pylint and python version:
pylint 1.4.4,
astroid 1.3.8, common 1.1.0
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1]

Doesn't handle Meta well

I have this Meta class in one of my models:

class Meta:
    unique_together = ('obj_1_id', 'obj_2_id', 'content_type')

This seemingly fine Meta class generates these errors using pylint and pylint-django:

$ pylint --rcfile /dev/null -r n --load-plugins pylint_django models.py
[...]
C: 40, 8: Missing class docstring (missing-docstring)
W: 40, 8: Class has no __init__ method (no-init)
C: 40, 8: Old-style class defined. (old-style-class)
R: 40, 8: Too few public methods (0/2) (too-few-public-methods)
W: 40, 8: Unused variable 'Meta' (unused-variable)

I have these versions:

pylint==1.4.3
pylint-django==0.6.1
pylint-plugin-utils==0.2.3

Wrong warning if parent model decorated with python_2_unicode_compatible

If we have models inheriting from one another, and the parent model has a @python_2_unicode_compatible decorator while the child fails to define unicode, we get a W5101 model-missing-unicode warning, when we should get a W5103 model-no-explicit-unicode warning. Minor, but does affect what pylint disable I should be placing on the code.

Creating releases to integrate pylint-django in Debian

Hi,

I'm Joseph, a Debian maintainer and as I tested a bit your pylint plugin, I would like to have it uploaded as a Debian package in the Debian official directories.

What would it mean?

  • Your plugin will be installable in Debian directly using "apt-get install pylint-django" (won't need to maintain other installation sources like pylint)
  • Your plugin will become available in the Debian derivatives like Ubuntu after some time (so it would give it more visibility)
  • Your package will be tested by Debian users and there will be some feedback (bugs, enhancement requests, etc) directly here or as Debian bug reports (in debian, everything is a bug, even questions so don't feel offended by the term). I'll then be a relay, proposing patches to you or just keeping in touch to get the bugs or enhancement in the releases to come. (without any time pressure. Some bugs take years before any patch is released for some applications!)
  • Your package would potentially be reviewed by the Debian security team and could get some interersting advices from there too.

What would be needed on your side?

  • I would have to know if you are ok with me packaging your application in Debian.
  • I would have to know if you plan to make GitHub releases (see: https://help.github.com/articles/creating-releases). Releases (which are basically tarballs of a point-in-time git/svn archive) help user follow easily the history of your package and help maintainers to have a more human-readable version numbers (without release we take the date of the git snapshot we take)

Thanks for your feedback.
Best,
Joseph

ModelForm Meta

Define a ModelForm:

# models.py
class Foo(models.Model):
        ...

# forms.py
class FooForm(forms.ModelForm):
    class Meta:
        ...

On running pylint with pylint_django, messages are shown for FooForm.Meta (C1001, W0232, R0903). It would be nice if these messages were suppressed as they are for Meta classes in Model subclasses.

Disable model-missing-unicode (W5101) not working

In pylintrc disabled the model-missing-unicode error, But its not working as we expected. We have integrated with prospector.

In .pylintrc,

disable=W5101 # W5101 - No unicode method on model

## OutPut
Line: 177
pylint: model-missing-unicode / No unicode method on model (Model1)
Line: 184
pylint: model-no-explicit-unicode / Model does not explicitly define unicode (Model2)
Line: 190
pylint: model-missing-unicode / No unicode method on model (Model3)
Line: 199
pylint: model-missing-unicode / No unicode method on model (Model4)

Note: Other disable options(cyclic-import, locally-disabled) is working fine

Model decorator python_2_unicode_compatible not recogised, warns missing unicode method

The model decorater @python_2_unicode_compatible can be used to turn a __str__ method return a unicode string (py2 unicode, py3 string) into the required __unicode__ on python 2.

pylint-django currently gives the message [W5101] No __unicode__ method on model (ModelName) for a class like:

@python_2_unicode_compatible
class ModelName(models.Model):
    name = models.CharField(max_length=200)

    def __str__(self):
        return self.name

See the Django Python 3 porting guide for details: https://docs.djangoproject.com/en/1.6/topics/python3/#str-and-unicode-methods

[no-member] Instance of 'Item' has no 'save' member

I discovered pylint-django after finding this stackoverflow thread.

However I still have some false pylint errors working with django:

[no-member] Instance of 'Item' has no 'full_clean' member
[no-member] Instance of 'Item' has no 'save' member

Is this something that pylint-django can help out with at all? Or is it some peculiar behaviour of django with forms and models that makes hard to deal with?

Ignore old-style-class for django-tables2 table Meta

I tried making the change myself in the is_model_meta_subclass parents whitelist but it didn't work.

The node_is_subclass check fails because inferred(base_cls)() returns [YES] instead of (presumably) a ClassDef node, but I couldn't track it down much further. It may have to do with the way that the Meta class is configured in django-tables2. See here.

ImportError: No module named pylint_django

Hi I got an error while try to run pylint with pylint_django

Traceback (most recent call last):
  File "/usr/local/bin/pylint", line 9, in <module>
    load_entry_point('pylint==1.4.1', 'console_scripts', 'pylint')()
  File "/Library/Python/2.7/site-packages/pylint/__init__.py", line 23, in run_pylint
    Run(sys.argv[1:])
  File "/Library/Python/2.7/site-packages/pylint/lint.py", line 1221, in __init__
    linter.load_plugin_modules(plugins)
  File "/Library/Python/2.7/site-packages/pylint/lint.py", line 450, in load_plugin_modules
    module = modutils.load_module_from_name(modname)
  File "/Library/Python/2.7/site-packages/astroid/modutils.py", line 137, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/Library/Python/2.7/site-packages/astroid/modutils.py", line 179, in load_module_from_modpath
    mp_file, mp_filename, mp_desc = imp.find_module(part, path)
ImportError: No module named pylint_django

python -c "import pylint_django" - works fine


Versions:

OS: OS X 10.11.4
Python: 2.7.10
pylint: 1.5.5
pylint-django: 0.7.1

Doesn't work with pylint 1.5.0 / astroid 1.4.0

  File "lib/python3.4/site-packages/pylint_django/utils.py", line 3, in <module>
    from astroid.bases import YES, Instance
ImportError: cannot import name 'YES'

If I fix that then:

  File "lib/python3.4/site-packages/pylint/lint.py", line 486, in load_plugin_modules
    module.register(self)
  File "lib/python3.4/site-packages/pylint_django/plugin.py", line 34, in register
    apply_augmentations(linter)
  File "lib/python3.4/site-packages/pylint_django/augmentations/__init__.py", line 300, in apply_augmentations
    augment_visit(linter, TypeChecker.visit_getattr, foreign_key_sets)
AttributeError: type object 'TypeChecker' has no attribute 'visit_getattr'

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

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.)

View.kwargs is an unsubscriptable-object

The following code generates an error:

    return super().get_queryset()\
        .filter(capability=self.kwargs['capability'])

views.py [unsubscriptable-object] Value 'self.kwargs' is unsubscriptable [python/pylint]

Fails with exception

Running pylint with pylint-django on Travis CI suddently fails:

Traceback (most recent call last):

File "/home/travis/virtualenv/python2.7.8/bin/pylint", line 9, in <module>

load_entry_point('pylint==1.3.1', 'console_scripts', 'pylint')()

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint/__init__.py", line 21, in run_pylint

Run(sys.argv[1:])

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint/lint.py", line 991, in __init__

linter.check(args)

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint/lint.py", line 585, in check

self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint/lint.py", line 662, in check_astroid_module

walker.walk(astroid)

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint/utils.py", line 804, in walk

self.walk(child)

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint/utils.py", line 806, in walk

cb(astroid)

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint_plugin_utils/__init__.py", line 54, in augment_func

augmentation(chain, node)

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint_plugin_utils/__init__.py", line 118, in do_suppress

if test_func(node):

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 203, in is_model_view_subclass_unused_argument

if not is_model_view_subclass_method_shouldnt_be_function(node):

File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 195, in is_model_view_subclass_method_shouldnt_be_function

return parent.name.endswith('View') and node_is_subclass(parent, subclass)

AttributeError: 'NoneType' object has no attribute 'name'

Support Django 1.7

Thanks for the awesome plugin! Any word on when you're planning to add support for Django 1.7?

AttributeError: 'module' object has no attribute 'versioninfo'

  File "/edx/app/edxapp/venvs/edxapp/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/__init__.py", line 23, in run_pylint
    Run(sys.argv[1:])
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/lint.py", line 1315, in __init__
    linter.check(args)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/lint.py", line 734, in check
    self._do_check(files_or_modules)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/lint.py", line 865, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/lint.py", line 945, in check_astroid_module
    walker.walk(ast_node)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/utils.py", line 938, in walk
    self.walk(child)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/utils.py", line 935, in walk
    cb(astroid)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/checkers/variables.py", line 1025, in visit_importfrom
    self._check_module_attrs(node, module, name.split('.'))
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint/checkers/variables.py", line 1091, in _check_module_attrs
    module = next(module.getattr(name)[0].infer())
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/astroid/bases.py", line 364, in infer
    return self._explicit_inference(self, context, **kwargs)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pylint_django/transforms/fields.py", line 37, in apply_type_shim
    if sys.versioninfo >= (3, 5):
AttributeError: 'module' object has no attribute 'versioninfo'

mongoengine.Document.objects is not callable

In the fake module mongoengine, the fake Document class is defined as

from mongoengine.errors import DoesNotExist, MultipleObjectsReturned

class Document(object):
    _meta = None
    objects = None

    id = None
    pk = None

    MultipleObjectsReturned = MultipleObjectsReturned
    DoesNotExist = DoesNotExist

    save = lambda: None

which member objects gives a None. The fact in mongoengine it should be a mongoengine.QuerySetManager, which is callable, and can be used as query method.

For now, the code
SomeDocument.objects(query)
pylint gives out a E1102. That should be fixed.

Pylint-Django Not Working in some Linux Environments? or it's just Local Issue?

Hi,

I am sorry to bother you and I am unsure if this right way of doing this.
I tested pylint-django on two Red Hat Linux Environments one works fine I am getting report back which different to the default pylint report
but when I tried it again on another Red Hat Linux Environment it doesn't work and it gives report the same as the default pylint report and no error is showing to tell me why this happening.

I am using pylint --load-plugins pylint_django file.py on the command line.

I was wondering what can cause this problem. Is there something I have installed that could be causing this.

Thank you for any help you can give me.

Invalid constant name "application" (invalid-name)

pylint_django complains about Django-generated code:

$ django-admin startproject testproj
$ cd testproj
$ pylint --load-plugins pylint_django testproj
No config file found, using default configuration
************* Module testproj.wsgi
C: 16, 0: Invalid constant name "application" (invalid-name)
…

Using: pylint==1.5.6 and pylint-django==0.7.2.

Form widgets warn about 'attrs' in constructor

Code like this:

widget=forms.TextInput(attrs={
    'class': 'form-control',
    'placeholder': 'Last Name'
})

ends up with errors like this:

Unexpected keyword argument 'attrs' in constructor call

AttributeError: 'Module' object has no attribute '_locals'

$ pylint  --load-plugins pylint_django projectname | egrep '^\*|^E:'
Traceback (most recent call last):
  File "/usr/bin/pylint", line 9, in <module>
    load_entry_point('pylint==1.4.3', 'console_scripts', 'pylint')()
  File "/usr/lib/python2.7/site-packages/pylint/__init__.py", line 23, in run_pylint
    Run(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/pylint/lint.py", line 1332, in __init__
************* Module projectname.external
************* Module projectname.SECRET_KEY
    linter.check(args)
  File "/usr/lib/python2.7/site-packages/pylint/lint.py", line 747, in check
    self._do_check(files_or_modules)
  File "/usr/lib/python2.7/site-packages/pylint/lint.py", line 869, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/usr/lib/python2.7/site-packages/pylint/lint.py", line 946, in check_astroid_module
    walker.walk(ast_node)
  File "/usr/lib/python2.7/site-packages/pylint/utils.py", line 874, in walk
    self.walk(child)
  File "/usr/lib/python2.7/site-packages/pylint/utils.py", line 874, in walk
    self.walk(child)
  File "/usr/lib/python2.7/site-packages/pylint/utils.py", line 871, in walk
    cb(astroid)
  File "/usr/lib/python2.7/site-packages/pylint_plugin_utils/__init__.py", line 54, in augment_func
    augmentation(chain, node)
  File "/usr/lib/python2.7/site-packages/pylint_plugin_utils/__init__.py", line 127, in do_suppress
    chain()
  File "/usr/lib/python2.7/site-packages/pylint_plugin_utils/__init__.py", line 53, in chain
    old_method(node)
  File "/usr/lib/python2.7/site-packages/pylint/checkers/base.py", line 1021, in visit_assname
    if isinstance(safe_infer(ass_type.value), astroid.Class):
  File "/usr/lib/python2.7/site-packages/pylint/checkers/utils.py", line 92, in safe_infer
    value = next(inferit)
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 327, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 351, in wrapper
    for node in func(*args, **kwargs):
  File "/usr/lib/python2.7/site-packages/astroid/inference.py", line 196, in infer_callfunc
    for infered in callee.infer_call_result(self, callcontext):
  File "/usr/lib/python2.7/site-packages/astroid/scoped_nodes.py", line 835, in infer_call_result
    for infered in returnnode.value.infer(context):
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 86, in cache_generator
    for result in generator:
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 327, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 351, in wrapper
    for node in func(*args, **kwargs):
  File "/usr/lib/python2.7/site-packages/astroid/inference.py", line 190, in infer_callfunc
    for callee in self.func.infer(context):
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 86, in cache_generator
    for result in generator:
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 327, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 124, in _infer_stmts
    for infered in stmt.infer(context):
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 86, in cache_generator
    for result in generator:
  File "/usr/lib/python2.7/site-packages/astroid/bases.py", line 327, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.7/site-packages/astroid/inference.py", line 229, in infer_from
    module = self.do_import_module()
  File "/usr/lib/python2.7/site-packages/astroid/mixins.py", line 107, in do_import_module
    return mymodule.import_module(modname, level=level)
  File "/usr/lib/python2.7/site-packages/astroid/scoped_nodes.py", line 431, in import_module
    return MANAGER.ast_from_module_name(modname)
  File "/usr/lib/python2.7/site-packages/astroid/manager.py", line 160, in ast_from_module_name
    return self.ast_from_file(filepath, modname, fallback=False)
  File "/usr/lib/python2.7/site-packages/astroid/manager.py", line 112, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
  File "/usr/lib/python2.7/site-packages/astroid/builder.py", line 134, in file_build
    module = self._data_build(data, modname, path)
  File "/usr/lib/python2.7/site-packages/astroid/builder.py", line 177, in _data_build
    module = rebuilder.visit_module(node, modname, node_file, package)
  File "/usr/lib/python2.7/site-packages/astroid/rebuilder.py", line 150, in visit_module
    return self._transform(newnode)
  File "/usr/lib/python2.7/site-packages/astroid/manager.py", line 337, in transform
    ret = transform_func(node)
  File "/usr/lib/python2.7/site-packages/pylint_django/transforms/__init__.py", line 29, in set_fake_locals
    module._locals[class_name] = fake._locals[class_name]  # pylint: disable=protected-access
AttributeError: 'Module' object has no attribute '_locals'

Does not handle ForeignKey model fields

A ForeignKey field on a model results in logs of "instance of ForeignKey has no member x" warnings as pylint does not know that Django swaps out the attribute.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.