Skip to content

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Sep 22, 2025

Misc cleanup after match PRs and other minor changes.

@cdce8p cdce8p added Maintenance Discussion or action around maintaining pylint or the dev workflow Skip news 🔇 This change does not require a changelog entry labels Sep 22, 2025
Comment on lines +1 to +4
Add new checks for invalid uses of class patterns in :keyword:`match`.
* :ref:`invalid-match-args-definition` is emitted if :py:data:`object.__match_args__` isn't a tuple of strings.
* :ref:`too-many-positional-sub-patterns` if there are more positional sub-patterns than specified in :py:data:`object.__match_args__`.
* :ref:`multiple-class-sub-patterns` if there are multiple sub-patterns for the same attribute.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref #10559

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see #10568 ?

Copy link
Member Author

@cdce8p cdce8p Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It looks quite promising though I only skimmed through it so far.

I only modified these here since I added the new checks just before adding the first refs.

case nodes.Tuple(elts=elts) if len(elts) > 0:
self.add_message("assert-on-tuple", node=node, confidence=HIGH)
case nodes.Const(value=str(val)):
case nodes.Const(value=str() as val):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do plan to add a checker for these soon.

Comment on lines 19 to +20
import astroid
import astroid.bases
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

astroid.bases is referenced in this file. It doesn't fail currently likely because other files also import it. Just add it here as well for good measure.

from typing import TYPE_CHECKING, Any, NamedTuple, TypeAlias

import astroid
import astroid.objects
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.93%. Comparing base (f0b41c0) to head (a78c2bf).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #10580      +/-   ##
==========================================
- Coverage   95.93%   95.93%   -0.01%     
==========================================
  Files         176      176              
  Lines       19471    19470       -1     
==========================================
- Hits        18679    18678       -1     
  Misses        792      792              
Files with missing lines Coverage Δ
pylint/checkers/base/basic_checker.py 98.32% <100.00%> (ø)
pylint/checkers/base/comparison_checker.py 98.59% <100.00%> (ø)
pylint/checkers/base/name_checker/checker.py 98.72% <100.00%> (+<0.01%) ⬆️
pylint/checkers/classes/class_checker.py 94.02% <100.00%> (+<0.01%) ⬆️
pylint/checkers/refactoring/refactoring_checker.py 98.23% <100.00%> (ø)
pylint/checkers/typecheck.py 96.31% <100.00%> (-0.01%) ⬇️
pylint/checkers/utils.py 95.96% <100.00%> (-0.01%) ⬇️
pylint/checkers/variables.py 97.41% <100.00%> (ø)
pylint/extensions/_check_docs_utils.py 93.72% <100.00%> (ø)
pylint/extensions/no_self_use.py 100.00% <100.00%> (ø)
... and 2 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This comment has been minimized.

Comment on lines -2046 to 2048
) and all(self._is_node_return_ended(_child) for _child in handlers)
case nodes.Assert(test=nodes.Const(value=value)) if not value:
case nodes.Assert(test=nodes.Const(value=False | 0)):
# consider assert False as a return node
return True
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess it's not enough to handle just assert False. Pytest also uses assert 0. Technically assert None or assert "" and similar could also be used, though I don't think they are common enough.

Copy link
Contributor

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit a78c2bf

@cdce8p cdce8p merged commit 4cea011 into pylint-dev:main Sep 23, 2025
44 checks passed
@cdce8p cdce8p deleted the misc-cleanup branch September 23, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow Skip news 🔇 This change does not require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants