Skip to content
Merged
Show file tree
Hide file tree
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 CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ Changelog
Version 2.6.2
-------------

We added support for pylint 4.0.0+.

Other
~~~~~

- CI now tests against Django 5.2
- CI now tests against python 3.13
- CI now tests against python 3.14

- CI now tests against pylint 4.0.0+

Version 2.6.1
-------------
Expand Down
19 changes: 10 additions & 9 deletions pylint_django/augmentations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
from pylint.checkers.design_analysis import MisdesignChecker
from pylint.checkers.newstyle import NewStyleConflictChecker
from pylint.checkers.typecheck import TypeChecker
from pylint.checkers.variables import ScopeConsumer, VariablesChecker
from pylint.checkers.variables import VariablesChecker

try: # Pylint <4.0
from pylint.checkers.variables import ScopeConsumer
except ImportError:
ScopeConsumer = None
from pylint_plugin_utils import augment_visit, suppress_message

from pylint_django.utils import PY3, node_is_subclass
Expand Down Expand Up @@ -324,16 +329,12 @@ def ignore_import_warnings_for_related_fields(orig_method, self, node):
continue
new_things[name] = stmts

# ScopeConsumer changed between pylint 2.12 and 2.13
# see https://github.com/pylint-dev/pylint/issues/5970#issuecomment-1078778393
if hasattr(consumer, "consumed_uncertain"):
# this is pylint >= 2.13, and the ScopeConsumer tuple has an additional field
if not ScopeConsumer: # Pylint 4.0+
consumer.to_consume = new_things
else: # Pylint <4.0
sc_args = (new_things, consumer.consumed, consumer.consumed_uncertain, consumer.scope_type)
else:
# this is <2.13 and does not have the consumer_uncertain field
sc_args = (new_things, consumer.consumed, consumer.scope_type)
consumer._atomic = ScopeConsumer(*sc_args) # pylint: disable=W0212

consumer._atomic = ScopeConsumer(*sc_args) # pylint: disable=W0212
self._to_consume = [consumer] # pylint: disable=W0212

return orig_method(self, node)
Expand Down
6 changes: 6 additions & 0 deletions pylint_django/transforms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def apply_type_shim(cls, _context=None): # pylint: disable=too-many-statements
else:
base_nodes = list(base_nodes[1])

# Add all ancestors inheriting from Field
for ancestor in cls.ancestors():
if ancestor.qname() == "django.db.models.fields.Field":
break
base_nodes.append(ancestor)

return iter([cls, *base_nodes])


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exclude = [ "**/tests/**", "**/testutils.py", "**/tests.py" ]
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
pylint-plugin-utils = ">=0.8"
pylint = ">=3.0,<4"
pylint = ">=3.0,<5"
Django = { version = ">=2.2", optional = true }

[tool.poetry.group.dev.dependencies]
Expand Down