Commit Graph
4 Commits
Author SHA1 Message Date
Brent Westbrook e4208ef9f9 Rename rule source files to match current rule names (#30661)
## Summary

As noted on #30660, this should be the actual final entry in the rename
stack, doing some internal cleanup on file, module, and function names
not covered by the previous rename PRs, which focused on the rule
structs themselves.

As the last PR in the stack, this closes #27011, which in turn closes
#1773.
2026-11-24 10:19:22 -05:00
David Peter fb03e3cff8 [ty] Use "Rule history" sections consistently (#30258)
# Summary

Follow-up to [the review comment on
#30143](https://github.com/astral-sh/ruff/pull/30143#discussion_r4513626692).
Move the migration notes for the four rules that were split in 0.0.100
into "Rule history" sections.
2026-11-10 10:26:10 +01:00
David PeterandAlex Waygood b8da5e8dbd [ty] Split out lost-keyword-for-regular-parameter from incompatible-method-override (#30143)
## Summary

We split out a new `lost-keyword-for-regular-parameter` rule for a
special case of `incompatible-method-override` where the overriding
method drops a keyword parameter (renames it, or makes it
positional-only). This is how the new diagnostic looks like:

```python
class Base:
    def scale(self, factor: int) -> int:
        return factor * 2


class Wrong(Base):
    def scale(self, multiplier: int) -> int:
        return multiplier * 3
```

```text
error[lost-keyword-for-regular-parameter]: Override of method `scale` disallows keyword arguments allowed by the method on the base class
 --> example.py:7:9
  |
7 |     def scale(self, multiplier: int) -> int:
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Definition is incompatible with `Base.scale`
  |
 ::: example.py:2:9
  |
2 |     def scale(self, factor: int) -> int:
  |         ------------------------------- `Base.scale` defined here
info: the parameter named `multiplier` does not match `factor` (and can be used as a keyword parameter)
info: This violates the Liskov Substitution Principle

Found 1 diagnostic
```

## Test strategy

New Markdown tests

<details>
<summary>Ecosystem impact</summary>

Across 165 projects, 1,946 existing errors moved from
`incompatible-method-override` to the new rule at the same locations and
severity. The linked run used the previous name,
`missing-keyword-in-override`.

The split surfaced 65 previously suppressed errors. Sphinx (28), Kornia
(25), and Altair (2) disable the old rule in configuration. The other 10
errors appeared at inline suppressions in pip, Streamlit, scipy-stubs,
and pandas-stubs. Seven of those comments also triggered
`unused-ignore-comment`.

The run reported no timeouts or abnormal exits and an average timing
factor of 1.00×.

</details>

---------

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2026-11-09 15:24:29 +00:00
David PeterandAlex Waygood 10775b0d4c [ty] Rename incompatible override rules (#30142)
Rename the method, attribute, property, and mutable override rules to
`incompatible-…-override`. The old names remain aliases in configuration
and inline suppressions:

| Before | After |
|---|---|
| `invalid-method-override` | `incompatible-method-override` |
| `invalid-attribute-override` | `incompatible-attribute-override` |
| `invalid-property-type-override` | `incompatible-property-override` |
| `invalid-mutable-override` | `incompatible-mutable-override` |

A follow-up PR will split `invalid-method-override` into two rules.

Fixes astral-sh/ty#2001.

---------

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2026-11-09 12:14:13 +01:00