ruff/crates/ruff_linter/src
Denys Kyslytsyn ed14dbb1a2
[flake8-pie] Avoid false positive for multiple assignment with auto() (PIE796) (#17274)
This fix closes #16868 

I noticed the issue is assigned, but the assignee appears to be actively
working on another pull request. I hope that’s okay!

<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

As of Python 3.11.1, `enum.auto()` can be used in multiple assignments.
This pattern should not trigger non-unique-enums check.
Reference: [Python docs on
enum.auto()](https://docs.python.org/3/library/enum.html#enum.auto)

This fix updates the check logic to skip enum variant statements where
the right-hand side is a tuple containing a call to `enum.auto()`.

## Test Plan

<!-- How was it tested? -->

The added test case uses the example from the original issue. It
previously triggered a false positive, but now passes successfully.
2025-04-08 15:53:27 -04:00
..
checkers [syntax-errors] Async comprehension in sync comprehension (#17177) 2025-04-08 12:50:52 -04:00
comments Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
cst Wrap expressions in parentheses when negating (#10346) 2024-03-11 18:20:55 -04:00
docstrings bump MSRV to 1.83 (#16294) 2025-02-26 06:12:43 -08:00
fix Upgrade to Rust 1.86 and bump MSRV to 1.84 (#17171) 2025-04-03 15:59:44 +00:00
importer Recognize all symbols named TYPE_CHECKING for in_type_checking_block (#15719) 2025-02-06 14:45:12 +01:00
message Upgrade to Rust 1.86 and bump MSRV to 1.84 (#17171) 2025-04-03 15:59:44 +00:00
registry Increase rule set size (#14689) 2024-11-30 15:12:10 +01:00
rules [flake8-pie] Avoid false positive for multiple assignment with auto() (PIE796) (#17274) 2025-04-08 15:53:27 -04:00
settings Escape template filenames in glob patterns (#16407) 2025-03-03 09:29:58 -05:00
snapshots [syntax-errors] Async comprehension in sync comprehension (#17177) 2025-04-08 12:50:52 -04:00
codes.rs Implement Invalid rule provided as rule RUF102 with --fix (#17138) 2025-04-04 08:05:59 +00:00
directives.rs Upgrade to Rust 1.86 and bump MSRV to 1.84 (#17171) 2025-04-03 15:59:44 +00:00
doc_lines.rs Extract LineIndex independent methods from Locator (#13938) 2024-10-28 07:53:41 +00:00
fs.rs Escape template filenames in glob patterns (#16407) 2025-03-03 09:29:58 -05:00
lib.rs Detect empty implicit namespace packages (#14236) 2024-11-09 22:03:34 -05:00
line_width.rs Upgrade to Rust 1.78 (#11260) 2024-05-03 12:46:21 +00:00
linter.rs [syntax-errors] Async comprehension in sync comprehension (#17177) 2025-04-08 12:50:52 -04:00
locator.rs test: another update to add back a caret 2025-01-15 13:37:52 -05:00
logging.rs Bump MSRV to Rust 1.80 (#13826) 2024-10-20 10:55:36 +02:00
noqa.rs Upgrade to Rust 1.86 and bump MSRV to 1.84 (#17171) 2025-04-03 15:59:44 +00:00
package.rs Detect empty implicit namespace packages (#14236) 2024-11-09 22:03:34 -05:00
packaging.rs Nested namespace packages support (#10541) 2024-03-24 22:53:32 -04:00
pyproject_toml.rs Update pyproject-toml to 0.8 (#8351) 2023-10-30 10:05:37 +00:00
registry.rs Sort linters alphabetically (#16168) 2025-02-14 22:05:08 +01:00
renamer.rs Add per-file-target-version option (#16257) 2025-02-24 08:47:13 -05:00
rule_redirects.rs [flake8-bandit] Move unsafe-markup-use from RUF035 to S704 (#15957) 2025-03-13 15:37:37 +01:00
rule_selector.rs Upgrade to Rust 1.86 and bump MSRV to 1.84 (#17171) 2025-04-03 15:59:44 +00:00
source_kind.rs Simplify iteration idioms (#13834) 2024-10-20 22:25:27 +01:00
test.rs [internal] Return Messages from check_path (#16837) 2025-03-19 10:08:07 -04:00
text_helpers.rs Handle non-printable characters in diff view (#11687) 2024-06-08 06:22:03 +00:00
upstream_categories.rs Fix pylint upstream categories not showing in docs (#10441) 2024-03-18 01:27:39 +00:00