pylint-dev / pylint-django

Pylint plugin for improving code analysis for when using Django
Other
591 stars 117 forks source link

Django-pylint don't recognize settings option in settings.json, neither work in UI #329

Open minifisk opened 3 years ago

minifisk commented 3 years ago

1) I can't get pylint-django to work as expected in the UI, I have activated the pylinter as the linter, but with the current settings nothing gets marked in my file. However, if I remove the line that loads the django settings ("--django-settings-module=jobs.settings") the linter start to work in the UI (but getting a ton of errors).

2) I've tried running the linter in the CLI by running:

pylint --load-plugins=pylint_django account_management_views.py

Which returns a list of suggestions from the linter on lines to be adjusted, which seems accurate, but getting a bit of weird errors, such as import problems with rest_framework (which I can find in pip freeze list, so it's not missing there). The most surprising thing is that one line say:

Account_management_views.py:1:0: E5110: Django was not configured. For more information run pylint --load-plugins=pylint_django --help-msg=django-not-configured (django-not-configured)

These are my settings:

"editor.formatOnSave": true,
  "python.formatting.provider": "autopep8",
  "python.linting.enabled": true,
  "python.linting.lintOnSave": true,
  "python.linting.pylintEnabled": true,
  "python.linting.pylintArgs": [
    "--load-plugins=pylint_django",
    "--django-settings-module=jobs.settings"
  ],
tauzahmd commented 3 years ago

https://github.com/PyCQA/pylint-django/issues/325#issuecomment-890500181