[pylint] Do not trigger PLR6201 on empty collections#15732
Merged
dylwil3 merged 1 commit intoastral-sh:mainfrom Jan 25, 2025
Merged
[pylint] Do not trigger PLR6201 on empty collections#15732dylwil3 merged 1 commit intoastral-sh:mainfrom
pylint] Do not trigger PLR6201 on empty collections#15732dylwil3 merged 1 commit intoastral-sh:mainfrom
Conversation
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLR6201 | 2 | 0 | 2 | 0 | 0 |
dylwil3
approved these changes
Jan 25, 2025
Collaborator
dylwil3
left a comment
There was a problem hiding this comment.
LGTM! Thank you!
I also agree with you that if someone writes 1 in [] it's probably an error, but this isn't the right rule to describe the error...
pylint] Do not trigger PLR6201 on empty collections
dcreager
added a commit
that referenced
this pull request
Jan 27, 2025
* main: Run `cargo update` (#15769) [red-knot] Document public symbol type inferece (#15766) Update dawidd6/action-download-artifact action to v8 (#15760) Update NPM Development dependencies (#15758) Update pre-commit dependencies (#15756) Update dependency ruff to v0.9.3 (#15755) Update dependency mdformat-mkdocs to v4.1.2 (#15754) Update Rust crate uuid to v1.12.1 (#15753) Update Rust crate unicode-ident to v1.0.15 (#15752) Fix docstring in ruff_annotate_snippets (#15748) Update Rust crate insta to v1.42.1 (#15751) Update Rust crate clap to v4.5.27 (#15750) Add references to `trio.run_process` and `anyio.run_process` (#15761) [`ruff`] Do not emit diagnostic when all arguments to `zip()` are variadic (`RUF058`) (#15744) [red-knot] Ensure differently ordered unions are considered equivalent when they appear inside tuples inside top-level intersections (#15743) [red-knot] Ensure differently ordered unions and intersections are understood as equivalent even inside arbitrarily nested tuples (#15740) [red-knot] Promote the `all_type_pairs_are_assignable_to_their_union` property test to stable (#15739) [`pylint`] Do not trigger `PLR6201` on empty collections (#15732) Improve the file watching failure error message (#15728) Speed symbol state merging back up (#15731)
This was referenced Mar 3, 2025
dylwil3
pushed a commit
that referenced
this pull request
May 6, 2025
Glyphack
pushed a commit
to Glyphack/ruff
that referenced
this pull request
May 6, 2025
## Summary Introducing a new rule based on discussions in astral-sh#15732 and astral-sh#15729 that checks for unnecessary in with empty collections. I called it in_empty_collection and gave the rule number RUF060. Rule is in preview group.
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 #15729.