Skip to content

Comments

[flake8-pyi] Make PEP-695 functions with multiple type parameters fixable by PYI019 again#15938

Merged
AlexWaygood merged 2 commits intomainfrom
alex/pyi019-bug
Feb 4, 2025
Merged

[flake8-pyi] Make PEP-695 functions with multiple type parameters fixable by PYI019 again#15938
AlexWaygood merged 2 commits intomainfrom
alex/pyi019-bug

Conversation

@AlexWaygood
Copy link
Member

Summary

I realised immediately after landing #15935 that the change introduced a small bug in PYI019, which meant that functions with multiple type parameters would no longer be autofixed if one of the type parameters had a bound or constraint. The bug slipped through in #15935 because we didn't have any test coverage for this specific edge case (which shows the risk of that kind of change!).

This PR fixes the new bug and adds test coverage for the edge case. I'm adding the "internal" label: this shouldn't be included in the changelog, because it's a new bug that hasn't been included in any release of Ruff.

Test Plan

cargo test -p ruff_linter --lib

@AlexWaygood AlexWaygood added bug Something isn't working internal An internal refactor or improvement labels Feb 4, 2025
@AlexWaygood AlexWaygood enabled auto-merge (squash) February 4, 2025 14:33
@AlexWaygood AlexWaygood merged commit 5bf0e2e into main Feb 4, 2025
21 checks passed
@AlexWaygood AlexWaygood deleted the alex/pyi019-bug branch February 4, 2025 14:38
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

dcreager added a commit that referenced this pull request Feb 4, 2025
* main: (66 commits)
  [red-knot] Use ternary decision diagrams (TDDs) for visibility constraints (#15861)
  [`pyupgrade`] Rename private type parameters in PEP 695 generics (`UP049`) (#15862)
  Simplify the `StringFlags` trait (#15944)
  [`flake8-pyi`] Make `PYI019` autofixable for `.py` files in preview mode as well as stubs (#15889)
  Docs (`linter.md`): clarify that Python files are always searched for in subdirectories (#15882)
  [`flake8-pyi`] Make PEP-695 functions with multiple type parameters fixable by PYI019 again (#15938)
  [red-knot] Use unambiguous invalid-syntax-construct for suppression comment test (#15933)
  Make `Binding::range()` point to the range of a type parameter's name, not the full type parameter (#15935)
  Update black deviations (#15928)
  [red-knot] MDTest: Fix line numbers in error messages (#15932)
  Preserve triple quotes and prefixes for strings (#15818)
  [red-knot] Hand-written MDTest parser (#15926)
  [`pylint`] Fix missing parens in unsafe fix for `unnecessary-dunder-call` (`PLC2801`) (#15762)
  nit: docs for ignore & select (#15883)
  [airflow] `BashOperator` has been moved to `airflow.providers.standard.operators.bash.BashOperator` (AIR302) (#15922)
  [`flake8-logging`] `.exception()` and `exc_info=` outside exception handlers (`LOG004`, `LOG014`) (#15799)
  [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890)
  [red-knot] Internal refactoring of visibility constraints API (#15913)
  [red-knot] Implicit instance attributes (#15811)
  [`flake8-comprehensions`] Handle extraneous parentheses around list comprehension (`C403`) (#15877)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant