Skip to content

Commit 82f64c6

Browse files
author
Carl Crowder
committed
Fixing linting errors
1 parent 1bf1481 commit 82f64c6

12 files changed

+15
-45
lines changed

pylint_django/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pylint_django import plugin
77

88
if sys.version_info < (3,):
9-
raise DeprecationWarning("Version 0.11.1 was the last to support Python 2. " "Please migrate to Python 3!")
9+
raise DeprecationWarning("Version 0.11.1 was the last to support Python 2. Please migrate to Python 3!")
1010

1111
register = plugin.register # pylint: disable=invalid-name
1212
load_configuration = plugin.load_configuration # pylint: disable=invalid-name

pylint_django/augmentations/__init__.py

+3-16
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,10 @@
1111
from django import VERSION as django_version
1212
from django.utils import termcolors
1313
from django.views.generic.base import ContextMixin, RedirectView, View
14-
from django.views.generic.dates import (
15-
DateMixin,
16-
DayMixin,
17-
MonthMixin,
18-
WeekMixin,
19-
YearMixin,
20-
)
21-
from django.views.generic.detail import (
22-
SingleObjectMixin,
23-
SingleObjectTemplateResponseMixin,
24-
TemplateResponseMixin,
25-
)
14+
from django.views.generic.dates import DateMixin, DayMixin, MonthMixin, WeekMixin, YearMixin
15+
from django.views.generic.detail import SingleObjectMixin, SingleObjectTemplateResponseMixin, TemplateResponseMixin
2616
from django.views.generic.edit import DeletionMixin, FormMixin, ModelFormMixin
27-
from django.views.generic.list import (
28-
MultipleObjectMixin,
29-
MultipleObjectTemplateResponseMixin,
30-
)
17+
from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin
3118
from pylint.checkers.base import DocStringChecker, NameChecker
3219
from pylint.checkers.classes import ClassChecker
3320
from pylint.checkers.design_analysis import MisdesignChecker

pylint_django/checkers/foreign_key_strings.py

+5-16
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,15 @@ def open(self):
8080
# state is stashed in this property.
8181

8282
try:
83-
from django.core.exceptions import ( # pylint: disable=import-outside-toplevel
84-
ImproperlyConfigured,
85-
)
83+
from django.core.exceptions import ImproperlyConfigured # pylint: disable=import-outside-toplevel
8684
except ModuleNotFoundError:
8785
return
8886

8987
try:
9088
import django # pylint: disable=import-outside-toplevel
9189

9290
django.setup()
93-
from django.apps import ( # noqa pylint: disable=import-outside-toplevel,unused-import
94-
apps,
95-
)
91+
from django.apps import apps # noqa pylint: disable=import-outside-toplevel,unused-import
9692

9793
# flake8: noqa=F401, F403
9894
except ImproperlyConfigured:
@@ -103,19 +99,14 @@ def open(self):
10399
# we will warn the user that they haven't actually configured Django themselves
104100
self._raise_warning = True
105101
# but use django defaults then...
106-
from django.conf import ( # pylint: disable=import-outside-toplevel
107-
settings,
108-
)
102+
from django.conf import settings # pylint: disable=import-outside-toplevel
109103

110104
settings.configure()
111105
django.setup()
112106
else:
113107
# see if we can load the provided settings module
114108
try:
115-
from django.conf import ( # pylint: disable=import-outside-toplevel
116-
Settings,
117-
settings,
118-
)
109+
from django.conf import Settings, settings # pylint: disable=import-outside-toplevel
119110

120111
settings.configure(Settings(self.config.django_settings_module))
121112
django.setup()
@@ -127,9 +118,7 @@ def open(self):
127118
args=self.config.django_settings_module,
128119
)
129120
# however we'll trundle on with basic settings
130-
from django.conf import ( # pylint: disable=import-outside-toplevel
131-
settings,
132-
)
121+
from django.conf import settings # pylint: disable=import-outside-toplevel
133122

134123
settings.configure()
135124
django.setup()

pylint_django/tests/input/func_noerror_form_fields.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
class ManyFieldsForm(forms.Form):
15-
1615
booleanfield = forms.BooleanField()
1716
charfield = forms.CharField(max_length=40, null=True)
1817
datetimefield = forms.DateTimeField(auto_now_add=True)

pylint_django/tests/input/func_noerror_forms_py33.py

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class Meta:
3434

3535

3636
class TestFormWidgetAssignment(forms.Form):
37-
3837
multi_field = forms.MultipleChoiceField(choices=[("1", "First"), ("2", "Second")])
3938

4039
class Meta:

pylint_django/tests/input/func_noerror_model_fields.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
class LotsOfFieldsModel(models.Model):
15-
1615
bigintegerfield = models.BigIntegerField()
1716
booleanfield = models.BooleanField(default=True)
1817
charfield = models.CharField(max_length=40, null=True)

pylint_django/tests/input/migrations/0002_new_column.py

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020

2121
class Migration(migrations.Migration):
22-
2322
dependencies = [
2423
("input", "0001_noerror_initial"),
2524
]

pylint_django/tests/input/migrations/0003_without_backwards.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ def forwards_test(apps, schema_editor):
77

88

99
class Migration(migrations.Migration):
10-
1110
operations = [
1211
migrations.RunPython(), # [missing-backwards-migration-callable]
1312
migrations.RunPython(forwards_test), # [missing-backwards-migration-callable]

pylint_django/tests/input/migrations/0004_noerror_with_backwards.py

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def backwards_test(apps, schema_editor):
1111

1212

1313
class Migration(migrations.Migration):
14-
1514
operations = [
1615
migrations.RunPython(forwards_test, backwards_test),
1716
migrations.RunPython(forwards_test, reverse_code=backwards_test),

pylint_django/transforms/fields.py

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def is_model_or_form_field(cls):
4747

4848

4949
def apply_type_shim(cls, _context=None): # noqa
50-
5150
if cls.name in _STR_FIELDS:
5251
base_nodes = scoped_nodes.builtin_lookup("str")
5352
elif cls.name in _INT_FIELDS:

pylint_django/transforms/foreignkey.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ def _module_name_from_django_model_resolution(model_name, module_name):
5151

5252

5353
def infer_key_classes(node, context=None):
54-
from django.core.exceptions import ( # pylint: disable=import-outside-toplevel
55-
ImproperlyConfigured,
56-
)
54+
from django.core.exceptions import ImproperlyConfigured # pylint: disable=import-outside-toplevel
5755

5856
keyword_args = []
5957
if node.keywords:

tox.ini

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ requires =
1919
commands =
2020
django_not_installed: bash pylint_django/tests/test_django_not_installed.sh
2121
django_is_installed: pylint --rcfile=tox.ini --load-plugins=pylint_django --disable=E5110 setup.py
22-
flake8: flake8
23-
pylint: pylint --rcfile=tox.ini -d missing-docstring,too-many-branches,too-many-return-statements,too-many-ancestors,fixme --ignore=tests pylint_django setup
22+
flake8: flake8 pylint_django/
23+
pylint: pylint --rcfile=tox.ini -d missing-docstring,too-many-branches,too-many-return-statements,too-many-ancestors,fixme --ignore=tests pylint_django
2424
readme: bash -c "poetry build && twine check dist/*"
2525
py{37,38,39,310,311}-django{22,30,31,32,40,41,42}: coverage run pylint_django/tests/test_func.py -v
2626
clean: find . -type f -name '*.pyc' -delete
@@ -56,5 +56,8 @@ allowlist_externals =
5656
[flake8]
5757
max-line-length = 120
5858

59+
[pylint]
60+
max-line-length = 120
61+
5962
[FORMAT]
6063
max-line-length=120

0 commit comments

Comments
 (0)