Skip to content

Pylint should not complain of django constants #41

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

Closed
lfrodrigues opened this issue Feb 10, 2015 · 6 comments
Closed

Pylint should not complain of django constants #41

lfrodrigues opened this issue Feb 10, 2015 · 6 comments

Comments

@lfrodrigues
Copy link
Contributor

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.

@carlio
Copy link
Member

carlio commented Feb 10, 2015

Good point!

If you're interested in making a pull request, the basic idea is in this file:
https://github.com/landscapeio/pylint-django/blob/master/pylint_django/augmentations/__init__.py#L290 - choose a message and selectively turn it off given the context.

Otherwise I'll do it myself but I probably don't have much time for a few weeks.

@carlio
Copy link
Member

carlio commented Feb 10, 2015

Actually, this is already present: https://github.com/landscapeio/pylint-django/blob/master/pylint_django/augmentations/__init__.py#L246

(insert my confused face)

@lfrodrigues
Copy link
Contributor Author

You're right, prospector wasn't detecting Django and not loading pylint-django...

@bittner
Copy link
Contributor

bittner commented Jan 12, 2017

Interesting. I'm using pylint with pylint-django, and pylint still complains about the usual lower-case constants used in Django (such as urlpatterns). Despite commit b5392e4.

I'm using Python 3.5.2, Django 1.10.4, pylint 1.6.4, astroid 1.4.9 and pylint-django 0.7.2. PyLint is run via tox 2.5.0. PyLint shows the pylint-django plugin loaded when running pylint --help (tox -e pylint -- --help, really).

What's wrong?

@safts
Copy link

safts commented May 31, 2017

I am having the same issue. I can see that pylint-django works, since I don't see warnings about ForeignKeys having no objects etc. However I get the same errors about urlpatterns. Any clues?

@a6kme
Copy link

a6kme commented Nov 9, 2017

+1

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