Skip to content

Conversation

dylwil3
Copy link
Collaborator

@dylwil3 dylwil3 commented Dec 18, 2024

This PR ensures that, when transforming a for-loop into a comprehension for the rule manual-list-comprehension (PERF401), we parenthesize if-stmt tests when they are assignment expressions.

Closes #15047

@dylwil3 dylwil3 added bug Something isn't working documentation Improvements or additions to documentation fixes Related to suggested fixes for violations labels Dec 18, 2024
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dylwil3 dylwil3 merged commit 596d80c into astral-sh:main Dec 19, 2024
21 checks passed
dylwil3 pushed a commit that referenced this pull request Jun 20, 2025
<!--
Thank you for contributing to Ruff/ty! 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? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary

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

While reading the docs I noticed this paragraph on `PERF401`. It was
added in the same PR that the bug with `:=` was fixed, #15050, but don't
know why it was added. The fix should already take care of adding the
parenthesis, so having this paragraph in the docs is just confusing
since it sounds like the user has to do something.

## Test Plan

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

N/A, no tests/functionality affected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF401 is triggered on for-loops that has the walrus operator inside
3 participants