ruff/crates/ruff_linter/resources/test/fixtures/perflint
Igor Drokin e4f64480da
[`perflint`] Ignore rule if target is `global` or `nonlocal` (`PERF401`) (#19539)
## Summary

Resolves #19531

I've implemented a check to determine whether the for_stmt target is
declared as global or nonlocal. I believe we should skip the rule in all
such cases, since variables declared this way are intended for use
outside the loop scope, making value changes expected behavior.

## Test Plan

Added two test cases for global and nonlocal variable to snapshot.
2025-07-28 17:03:22 -04:00
..
PERF101.py [`perflint`] Fix `PERF101` autofix creating a syntax error and mark autofix as unsafe if there are comments in the `list` call expr (#18803) 2025-06-23 11:51:46 +00:00
PERF102.py Add padding in `PERF102` fixes (#7554) 2023-09-20 19:33:54 -04:00
PERF203.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PERF401.py [`perflint`] Ignore rule if target is `global` or `nonlocal` (`PERF401`) (#19539) 2025-07-28 17:03:22 -04:00
PERF402.py Ignore list-copy recommendations for async `for` loops (#11250) 2024-05-02 11:48:52 -07:00
PERF403.py [`perflint`] Fix `PERF403` panic on attribute or subscription loop variable (#19042) 2025-06-30 10:47:49 -04:00