Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

  • PYI003

    Unrecognized sys.version_info check

    No autofix
  • PYI004

    Version comparison must use only major and minor version

    No autofix
  • PYI005

    Version comparison must be against a length-{expected_length} tuple

    No autofix
  • PYI006

    Use < or >= for sys.version_info comparisons

    No autofix
  • PYI007

    Unrecognized sys.platform check

    No autofix
  • PYI008

    Unrecognized platform {platform}

    No autofix
  • PYI009

    Empty body should contain ..., not pass

    Always autofixable
  • PYI010

    Function body must contain only ...

    Always autofixable
  • PYI011

    Only simple default values allowed for typed arguments

    Always autofixable
  • PYI012

    Class body must not contain pass

    Always autofixable
  • PYI013

    Non-empty class body must not contain ...

    Always autofixable
  • PYI014

    Only simple default values allowed for arguments

    Always autofixable
  • PYI015

    Only simple default values allowed for assignments

    Always autofixable
  • PYI016

    Duplicate union member {}

    Some reports are autofixable
  • PYI017

    Stubs should not contain assignments to attributes or multiple targets

    No autofix
  • PYI018

    Private {type_var_like_kind} {type_var_like_name} is never used

    Always autofixable
  • 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