Skip to content

[perflint] Catch a wider range of mutations in PERF101#9955

Merged
charliermarsh merged 1 commit intomainfrom
charlie/append
Feb 12, 2024
Merged

[perflint] Catch a wider range of mutations in PERF101#9955
charliermarsh merged 1 commit intomainfrom
charlie/append

Conversation

@charliermarsh
Copy link
Member

Summary

This PR ensures that if a list x is modified within a for loop, we avoid flagging list(x) as unnecessary. Previously, we only detected calls to exactly .append, and they couldn't be nested within other statements.

Closes #9925.

@charliermarsh charliermarsh added the bug Something isn't working label Feb 12, 2024
@charliermarsh charliermarsh marked this pull request as ready for review February 12, 2024 17:00
@charliermarsh charliermarsh merged commit 0304623 into main Feb 12, 2024
@charliermarsh charliermarsh deleted the charlie/append branch February 12, 2024 17:17
@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
…#9955)

## Summary

This PR ensures that if a list `x` is modified within a `for` loop, we
avoid flagging `list(x)` as unnecessary. Previously, we only detected
calls to exactly `.append`, and they couldn't be nested within other
statements.

Closes astral-sh#9925.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PERF101 false positive

1 participant