Skip to content

[flake8-pyi] Fix false positive in __all__ (PYI053)#26872

Open
ntBre wants to merge 3 commits into
mainfrom
brent/pyi053-dunder-all
Open

[flake8-pyi] Fix false positive in __all__ (PYI053)#26872
ntBre wants to merge 3 commits into
mainfrom
brent/pyi053-dunder-all

Conversation

@ntBre

@ntBre ntBre commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a false positive on long strings in __all__. These strings correspond to existing
exported symbols and are out of the stub author's control.

I initially hoped that we could use the existing Semantic::in_dunder_all_definition, but this is
only set in Checker::visit_exports and used for adding global references, so the flag is no longer
set when the rule runs in Checker::visit_expr.

I found another similar piece of existing code in Checker::handle_node_store and factored that out
into a Checker helper method.

Test Plan

New mdtest

ntBre added 3 commits July 15, 2026 17:23
Summary
--

This PR fixes a false positive on long strings in `__all__`. These strings correspond to existing
exported symbols and are out of the stub author's control.

I initially hoped that we could use the existing `Semantic::in_dunder_all_definition`, but this is
only set in `Checker::visit_exports` and used for adding global references, so the flag is no longer
set when the rule runs in `Checker::visit_expr`.

I found another similar piece of existing code in `Checker::handle_node_store` and factored that out
into a `Checker` helper method.

Test Plan
--

New mdtest
@ntBre ntBre added bug Something isn't working rule Implementing or modifying a lint rule labels Jul 15, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre marked this pull request as ready for review July 15, 2026 21:35
@MichaReiser MichaReiser self-requested a review July 16, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant