[flake8-pyi] Mention stubs in the diagnostic message (PYI002) - #28542
Merged
Merged
Conversation
devtechedge
added a commit
to devtechedge/oss-contributions
that referenced
this pull request
Sep 11, 2026
…om pipeline to Open
devtechedge
added a commit
to devtechedge/oss-contributions
that referenced
this pull request
Sep 12, 2026
…om pipeline to Open
flake8-pyi] Mention stubs in the diagnostic message (PYI002)
ntBre
enabled auto-merge (squash)
September 17, 2026 14:25
auto-merge was automatically disabled
September 17, 2026 14:30
Pull request was closed
ntBre
enabled auto-merge (squash)
September 17, 2026 14:31
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PYI002 | 8 | 4 | 4 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+4 -4 violations, +0 -0 fixes in 1 projects; 58 projects unchanged)
bokeh/bokeh (+4 -4 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --no-fix --output-format concise --preview --select ALL
+ src/bokeh/core/property/visual.pyi:19:4: complex-if-statement-in-stub `if` test in a stub file must be a simple comparison against `sys.platform` or `sys.version_info` - src/bokeh/core/property/visual.pyi:19:4: complex-if-statement-in-stub `if` test must be a simple comparison against `sys.platform` or `sys.version_info` + src/bokeh/models/plots.pyi:52:4: complex-if-statement-in-stub `if` test in a stub file must be a simple comparison against `sys.platform` or `sys.version_info` - src/bokeh/models/plots.pyi:52:4: complex-if-statement-in-stub `if` test must be a simple comparison against `sys.platform` or `sys.version_info` + src/bokeh/models/sources.pyi:22:4: complex-if-statement-in-stub `if` test in a stub file must be a simple comparison against `sys.platform` or `sys.version_info` - src/bokeh/models/sources.pyi:22:4: complex-if-statement-in-stub `if` test must be a simple comparison against `sys.platform` or `sys.version_info` + src/bokeh/plotting/_figure.pyi:25:4: complex-if-statement-in-stub `if` test in a stub file must be a simple comparison against `sys.platform` or `sys.version_info` - src/bokeh/plotting/_figure.pyi:25:4: complex-if-statement-in-stub `if` test must be a simple comparison against `sys.platform` or `sys.version_info`
Changes by rule (1 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| complex-if-statement-in-stub | 8 | 4 | 4 | 0 | 0 |
Contributor
Author
|
Thanks for merging, @ntBre. Your rename to the [ Keeping this one message-only while Y002 carried its own wording made the review story much cleaner than bundling the two. Appreciate the quick review cycle here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #27324
The PYI002 diagnostic read as a statement about the flagged test itself, which is confusing when the condition does not mention
sys.platformorsys.version_infoat all (the case in the issue). The rule's expectation is thatiftests in stub files are simple comparisons, so the message now names that context:This is a message-only change; rule behavior is unchanged. The Y002 fixtures and snapshots are untouched since that rule carries its own message, and the
PYI002.pyi.snapoutput is updated to match.