Skip to content

Continue applying transforms after a None return - #3441

Open
LJimmy007 wants to merge 1 commit into
pylint-dev:mainfrom
LJimmy007:fix/809-transform-none-chain
Open

LJimmy007 wants to merge 1 commit into
pylint-dev:mainfrom
LJimmy007:fix/809-transform-none-chain

Conversation

@LJimmy007

Copy link
Copy Markdown

Type of Changes

Type
✓ 🐛 Bug fix

Description

A transform returning None currently stops the remaining transforms because
None.__class__ differs from the node's class. Only check for a type change when
the transform returns a replacement. This preserves the current node and lets
later applicable transforms run, while retaining the existing stop behavior for
replacements of a different type.

Add regression tests for None returns, same-type and different-type replacements,
false predicates, and inference cache invalidation, plus a changelog entry.

Closes #809

Validation on Windows / Python 3.13.5:

  • The new None-chain regression fails before the fix; all 14 transform tests pass
    afterward. astroid/transforms.py has 100% line and branch coverage (50
    statements, 20 branches), including every changed line and branch.
  • The issue's two-plugin example with Pylint 4.1.3 now calls the second plugin for
    both One and Two.
  • Full suite: 2496 passed, 64 skipped, 15 xfailed; five Windows symlink-related
    failures also occur on the unchanged production baseline. No new failures.
  • All configured pre-commit checks passed. Prettier 3.9.10 was run separately
    with the configured options using the installed Node runtime.

AI assistance: OpenAI Codex was used for implementation and validation, including
a separate AI review of the diff, regression tests and verification evidence.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Next transformer not called if previous transformer returns None.

3 participants