Improve docs on how to stop Ruff and ty disagreeing with each other#21644
Merged
AlexWaygood merged 1 commit intomainfrom Nov 27, 2025
Merged
Improve docs on how to stop Ruff and ty disagreeing with each other#21644AlexWaygood merged 1 commit intomainfrom
AlexWaygood merged 1 commit intomainfrom
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
a6c4c27 to
09030c9
Compare
|
MichaReiser
approved these changes
Nov 27, 2025
Comment on lines
+2086
to
+2090
| /// This can usually be resolved by adding [`@typing.override`][override] to your method | ||
| /// definition. Ruff knows that a method decorated with `@typing.override` is intended to | ||
| /// override a method by the same name on a superclass, and avoids reporting rules like ARG002 | ||
| /// for such methods; it knows that the changes recommended by ARG002 would violate the Liskov | ||
| /// Substitution Principle. |
Member
There was a problem hiding this comment.
Someday this will no longer be required, because Ruff could check itself whether this is an overriden method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lots of Ruff rules encourage you to make changes that might then cause ty to start complaining about Liskov violations. Most of these Ruff rules already refrain from complaining about a method if they see that the method is decorated with
@override, but this usually isn't documented. This PR updates the docs of many Ruff rules to note that they refrain from complaining about@override-decorated methods, and also adds a similar note to the tyinvalid-method-overridedocumentation.Helps with astral-sh/ty#1644 (comment)
Test Plan
uvx prek run -alocally