Skip to content

Ruff

903 rules ruff@0.17.0

Complete effective rule inventory.

Docs

Rules

32 rules on this page · 903 total

  • PYI019

    Use Self instead of custom TypeVar {}

    Some reports are autofixable
  • PYI020

    Quoted annotations should not be included in stubs

    Always autofixable
  • PYI021

    Docstrings should not be included in stubs

    Always autofixable
  • PYI024

    Use typing.NamedTuple instead of collections.namedtuple

    No autofix
  • PYI025

    Use from collections.abc import Set as AbstractSet to avoid confusion with the set builtin

    Some reports are autofixable
  • PYI026

    Use {module}.TypeAlias for type alias, e.g., {name}: TypeAlias = {value}

    Always autofixable
  • PYI029

    Defining {name} in a stub is almost always redundant

    Always autofixable
  • PYI030

    Multiple literal members in a union. Use a single literal, e.g. Literal[{}]

    Always autofixable
  • PYI032

    Prefer object to Any for the second parameter to {method_name}

    Always autofixable
  • PYI033

    Don't use type comments

    No autofix
  • PYI034

    __new__ methods usually return self at runtime

    Some reports are autofixable
  • PYI035

    {name} in a stub file must have a value, as it has the same semantics as {name} at runtime

    No autofix
  • PYI036

    Star-args in {method_name} should be annotated with object

    Some reports are autofixable
  • PYI041

    Use {supertype} instead of {subtype} | {supertype}

    Some reports are autofixable
  • PYI042

    Type alias {name} should be CamelCase

    No autofix
  • PYI043

    Private type alias {name} should not be suffixed with T (the T suffix implies that an object is a TypeVar)

    No autofix
  • PYI044

    from __future__ import annotations has no effect in stub files, since type checkers automatically treat stubs as having those semantics

    Some reports are autofixable
  • PYI045

    __aiter__ methods should return an AsyncIterator, not an AsyncIterable

    No autofix
  • PYI046

    Private protocol {name} is never used

    No autofix
  • PYI047

    Private TypeAlias {name} is never used

    No autofix
  • PYI048

    Function body must contain exactly one statement

    No autofix
  • PYI049

    Private TypedDict {name} is never used

    No autofix
  • PYI050

    Prefer {module}.Never over NoReturn for argument annotations

    No autofix
  • PYI051

    Literal[{literal}] is redundant in a union with {builtin_type}

    No autofix
  • PYI052

    Need type annotation for {name}

    No autofix
  • PYI053

    String and bytes literals longer than 50 characters are not permitted

    Always autofixable
  • PYI054

    Numeric literals with a string representation longer than ten characters are not permitted

    Always autofixable
  • PYI055

    Multiple type members in a union. Combine them into one, e.g., type[{union_str}].

    Some reports are autofixable
  • PYI056

    Calling .{name}() on __all__ may not be supported by all type checkers (use += instead)

    No autofix
  • PYI057

    Do not use {origin}.ByteString, which has unclear semantics and is deprecated

    No autofix
  • PYI058

    Use {return_type} as the return value for simple {method} methods

    Some reports are autofixable
  • PYI059

    Generic[] should always be the last base class

    Some reports are autofixable