Skip to content

Fixing NameChecker's const regex expression could be NoneType bug #111

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
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pylint_django/plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Common Django module."""
from pylint.checkers.base import NameChecker
from pylint.checkers.base import NameChecker, UpperCaseStyle
from pylint_django.augmentations import apply_augmentations
from pylint_plugin_utils import get_checker
import re
Expand All @@ -19,6 +19,8 @@ def register(linter):
name_checker.config.good_names += ('qs',)

# Default pylint.checkers.base.CONST_NAME_RGX = re.compile('(([A-Z_][A-Z0-9_]*)|(__.*__))$').
if name_checker.config.const_rgx is None:
name_checker.config.const_rgx = UpperCaseStyle.CONST_NAME_RGX
start = name_checker.config.const_rgx.pattern[:-2]
end = name_checker.config.const_rgx.pattern[-2:]
const_rgx = '%s|(urls|urlpatterns|register)%s' % (start, end)
Expand Down