ruff
34e8de73 - [`perflint`] Expand `PERF401` and `PERF402` with type checks (#6994)

Comment changes are shownComment changes are hidden
Commit
1 year ago
[`perflint`] Expand `PERF401` and `PERF402` with type checks (#6994) ## Summary Attempt at a small improvement to two `perflint` rules using the new type inference capabilities to only flag `PERF401` and `PERF402` for values we infer to be lists. This makes the rule more conservative, as it only flags values that we _know_ to be lists, but it's overall a desirable change, as it favors false negatives over false positives for a "nice-to-have" rule. Closes https://github.com/astral-sh/ruff/issues/6995. ## Test Plan Add non-list value cases and make sure all old cases are still caught.
Author
Parents
  • crates/ruff
    • resources/test/fixtures/perflint
      • File
        PERF401.py
      • File
        PERF402.py
    • src/rules/perflint/rules
      • File
        manual_list_comprehension.rs
      • File
        manual_list_copy.rs