Skip to content

Commit

Permalink
[ruff] Activate ruff's pylint messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Oct 9, 2024
1 parent 05ccb0a commit 12f309f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
13 changes: 6 additions & 7 deletions pylint_django/augmentations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,11 @@ class ModelB(models.Model):
# if this is a X_set method, that's a pretty strong signal that this is the default
# Django name, rather than one set by related_name
quack = True
else:
# we will
if isinstance(node.parent, Attribute):
func_name = getattr(node.parent, "attrname", None)
if func_name in MANAGER_ATTRS:
quack = True
# we will
elif isinstance(node.parent, Attribute):
func_name = getattr(node.parent, "attrname", None)
if func_name in MANAGER_ATTRS:
quack = True

if quack:
children = list(node.get_children())
Expand Down Expand Up @@ -522,7 +521,7 @@ def _attribute_is_magic(node, attrs, parents):
try:
for cls in node.last_child().inferred():
if isinstance(cls, Super):
cls = cls._self_class # pylint: disable=protected-access
cls = cls._self_class # pylint: disable=protected-access # noqa:PLW2901
if node_is_subclass(cls, *parents) or cls.qname() in parents:
return True
except InferenceError:
Expand Down
2 changes: 1 addition & 1 deletion pylint_django/checkers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ModelChecker(BaseChecker):
msgs = MESSAGES

@check_messages("model-missing-unicode")
def visit_classdef(self, node):
def visit_classdef(self, node): # noqa: PLR0911
"""Class visitor."""
if not node_is_subclass(node, "django.db.models.base.Model", ".Model"):
# we only care about models
Expand Down
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,22 @@ lint.select = [
"I", # isort
"PGH004", # pygrep-hooks - Use specific rule codes when using noqa
"PIE", # flake8-pie
"PLC", # pylint convention
"PLE", # pylint error
"PLR", # pylint refactor
"PLR1714", # Consider merging multiple comparisons
"PLW", # pylint warning
"PYI", # flake8-pyi
"RUF", # ruff
"T100", # flake8-debugger
"UP", # pyupgrade
"W", # pycodestyle
]
lint.ignore = [
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"PLR0912", # Too many branches, worse than C901
"PLR0915", # Too many statements, worse than C901
"PLR2004", # Magic value used in comparison, opinionated
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
]

[tool.isort]
Expand Down

0 comments on commit 12f309f

Please sign in to comment.