Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

  • 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
  • PYI061

    Use None rather than Literal[None]

    Some reports are autofixable
  • PYI062

    Duplicate literal member {}

    Always autofixable
  • PYI063

    Use PEP 570 syntax for positional-only parameters

    No autofix
  • PYI064

    Final[Literal[{literal}]] can be replaced with a bare Final

    Some reports are autofixable
  • PYI066

    Put branches for newer Python versions first when branching on sys.version_info comparisons

    No autofix
  • pytest-fixture-autouse

    Avoid using autouse=True in pytest.fixture decorators

    No autofix
  • Q000

    Single quotes found but double quotes preferred

    Some reports are autofixable
  • Q001

    Single quote multiline found but double quotes preferred

    Always autofixable
  • Q002

    Single quote docstring found but double quotes preferred

    Some reports are autofixable
  • Q003

    Change outer quotes to avoid escaping inner quotes

    Always autofixable
  • Q004

    Unnecessary escape on inner quote character

    Always autofixable
  • RET501

    Do not explicitly return None in function if it is the only possible return value

    Always autofixable
  • RET502

    Do not implicitly return None in function able to return non-None value

    Always autofixable
  • RET503

    Missing explicit return at the end of function able to return non-None value

    Always autofixable
  • RET504

    Unnecessary assignment to {name} before return statement

    Always autofixable
  • RET505

    Unnecessary {branch} after return statement

    Some reports are autofixable
  • RET506

    Unnecessary {branch} after raise statement

    Some reports are autofixable
  • RET507

    Unnecessary {branch} after continue statement

    Some reports are autofixable
  • RET508

    Unnecessary {branch} after break statement

    Some reports are autofixable
  • RSE102

    Unnecessary parentheses on raised exception

    Always autofixable
  • RUF002

    Docstring contains ambiguous {}. Did you mean {}?

    No autofix
  • RUF003

    Comment contains ambiguous {}. Did you mean {}?

    No autofix
  • RUF005

    Consider {expression} instead of concatenation

    Some reports are autofixable
  • RUF006

    Store a reference to the return value of {expr}.{method}

    No autofix
  • RUF007

    Prefer itertools.pairwise() over zip() when iterating over successive pairs

    Some reports are autofixable
  • RUF008

    Do not use mutable default values for dataclass attributes

    No autofix
  • RUF009

    Do not perform function call {name} in dataclass defaults

    No autofix
  • RUF010

    Use explicit conversion flag

    Some reports are autofixable
  • RUF012

    Mutable default value for class attribute

    No autofix
  • RUF013

    PEP 484 prohibits implicit Optional

    Some reports are autofixable
  • RUF015

    Prefer next({iterable}) over single element slice

    Always autofixable
  • RUF016

    Slice in indexed access to type {value_type} uses type {index_type} instead of an integer

    No autofix