Repository: astral-sh/ruff
File: crates/ty_python_semantic/src/types/diagnostic.rs (Rust)

Code before:
    ///
    /// ## Why is this bad?
    /// Using a non-runtime-checkable protocol in these contexts raises `TypeError`
    /// at runtime.
    ///
    /// ## Examples
    /// ```python
    /// from typing_extensions import Protocol
    ///
    /// class HasX(Protocol):
    ///     x: int
    ///
    /// def f(arg: object, arg2: type):
    ///     isinstance(arg, HasX)  # error: [isinstance-against-protocol]
    ///     issubclass(arg2, HasX)  # error: [isinstance-against-protocol]
    ///
    /// def g(arg: object):
    ///     match arg:
    ///         case HasX():  # error: [isinstance-against-protocol]
    ///             pass
    /// ```
    pub(crate) static ISINSTANCE_AGAINST_PROTOCOL = {
        summary: "reports runtime checks against non-runtime-checkable protocol classes",
        status: LintStatus::stable("0.0.10"),
        default_level: Level::Error,
    }
}

declare_lint! {
    /// ## What it does
    /// Detects call arguments whose type is not assignable to the corresponding typed parameter.
    ///
    /// ## Why is this bad?
    /// Passing an argument of a type the function (or callable object) does not accept violates
    /// the expectations of the function author and may cause unexpected runtime errors within the
    /// body of the function.
    ///
    /// ## Examples
    /// ```python
    /// def func(x: int): ...
    /// func("foo")  # error: [invalid-argument-type]
    /// ```
    pub(crate) static INVALID_ARGUMENT_TYPE = {
        summary: "detects call arguments whose type is not assignable to the corresponding typed parameter",
        status: LintStatus::stable("0.0.1-alpha.1"),
        default_level: Level::Error,
    }
}

declare_lint! {
    /// ## What it does

Review comment (suggestion):
````suggestion
    /// ```
    ///
    /// ## References
    /// - [Typing documentation: `@runtime_checkable`](https://docs.python.org/3/library/typing.html#typing.runtime_checkable)
````

Code after:
declare_lint! {
    /// ## What it does
    /// Reports runtime checks against non-runtime-checkable `Protocol` classes.
    /// This includes explicit calls to `isinstance()`/`issubclass()` and implicit
    /// checks performed by `match` class patterns.
    ///
    /// ## Why is this bad?
    /// Using a non-runtime-checkable protocol in these contexts raises `TypeError`
    /// at runtime.
    ///
    /// ## Examples
    /// ```python
    /// from typing_extensions import Protocol
    ///
    /// class HasX(Protocol):
    ///     x: int
    ///
    /// def f(arg: object, arg2: type):
    ///     isinstance(arg, HasX)  # error: [isinstance-against-protocol]
    ///     issubclass(arg2, HasX)  # error: [isinstance-against-protocol]
    ///
    /// def g(arg: object):
    ///     match arg:
    ///         case HasX():  # error: [isinstance-against-protocol]
    ///             pass
    /// ```
    ///
    /// ## References
    /// - [Typing documentation: `@runtime_checkable`](https://docs.python.org/3/library/typing.html#typing.runtime_checkable)
    pub(crate) static ISINSTANCE_AGAINST_PROTOCOL = {
        summary: "reports runtime checks against non-runtime-checkable protocol classes",
        status: LintStatus::stable("0.0.14"),
        default_level: Level::Error,
    }
}

declare_lint! {
    /// ## What it does
    /// Detects call arguments whose type is not assignable to the corresponding typed parameter.
    ///
    /// ## Why is this bad?
    /// Passing an argument of a type the function (or callable object) does not accept violates
    /// the expectations of the function author and may cause unexpected runtime errors within the
    /// body of the function.
    ///
    /// ## Examples
    /// ```python
    /// def func(x: int): ...
    /// func("foo")  # error: [invalid-argument-type]
    /// ```
    pub(crate) static INVALID_ARGUMENT_TYPE = {