mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-29 03:02:27 +00:00
## Summary Fixes false positives (and incorrect autofixes) in `nested-min-max` (`PLW3301`) when the outer `min`/`max` call only has a single argument. Previously the rule would flatten: ```python min(min([2, 3], [4, 1])) ``` into `min([2, 3], [4, 1])`, changing the semantics. The rule now skips any nested call when the outer call has only one positional argument. The pylint fixture and snapshot were updated accordingly. ## Test Plan Ran Ruff against the updated `nested_min_max.py` fixture: ```shell cargo run -p ruff -- check crates/ruff_linter/resources/test/fixtures/pylint/nested_min_max.py --no-cache --select=PLW3301 --preview ``` to verify that `min(min([2, 3], [4, 1]))` and `max(max([2, 4], [3, 1]))` are no longer flagged. Updated the fixture and snapshot; all other existing warnings remain unchanged. The code compiles and the unit tests pass. --- This PR was generated by an AI system in collaboration with maintainers: @carljm, @ntBre Fixes #16163 --------- Signed-off-by: Gene Parmesan Thomas <201852096+gopoto@users.noreply.github.com> Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com> |
||
|---|---|---|
| .. | ||
| test | ||
| __init__.py | ||