Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

  • RUF017

    Avoid quadratic list summation

    Always autofixable
  • RUF018

    Avoid assignment expressions in assert statements

    No autofix
  • RUF019

    Unnecessary key check before dictionary access

    Always autofixable
  • RUF020

    {never_like} | T is equivalent to T

    Some reports are autofixable
  • RUF021

    Parenthesize a and b expressions when chaining and and or together, to make the precedence clear

    Always autofixable
  • RUF022

    __all__ is not sorted

    Some reports are autofixable
  • RUF023

    {}.__slots__ is not sorted

    Some reports are autofixable
  • RUF024

    Do not pass mutable objects as values to dict.fromkeys

    Always autofixable
  • RUF026

    default_factory is a positional-only argument to defaultdict

    Some reports are autofixable
  • RUF027

    Possible f-string without an f prefix

    Always autofixable
  • RUF028

    This suppression comment is invalid because {}

    Always autofixable
  • RUF029

    Function {name} is declared async, but doesn't await or use async features.

    No autofix
  • RUF030

    print() call in assert statement is likely unintentional

    Always autofixable
  • RUF031

    Use parentheses for tuples in subscripts

    Always autofixable
  • RUF032

    Decimal() called with float literal argument

    Always autofixable
  • RUF033

    __post_init__ method with argument defaults

    Some reports are autofixable
  • RUF034

    Useless if-else condition

    No autofix
  • RUF036

    None not at the end of the type union.

    Some reports are autofixable
  • RUF037

    Unnecessary empty iterable within a deque call

    Some reports are autofixable
  • RUF038

    Literal[True, False, ...] can be replaced with Literal[...] | bool

    Some reports are autofixable
  • RUF039

    First argument to {call} is not raw string

    Some reports are autofixable
  • RUF040

    Non-string literal used as assert message

    No autofix
  • RUF041

    Unnecessary nested Literal

    Always autofixable
  • RUF043

    Pattern passed to match= contains metacharacters but is neither escaped nor raw

    No autofix
  • RUF045

    Assignment without annotation found in dataclass body

    No autofix
  • RUF046

    Value being cast to int is already an integer

    Always autofixable
  • RUF047

    Empty else clause

    Always autofixable
  • RUF048

    __version__ may contain non-integral-like elements

    No autofix
  • RUF049

    An enum class should not be decorated with @dataclass

    No autofix
  • RUF050

    Empty if statement

    Always autofixable
  • RUF051

    Use pop instead of key in dict followed by del dict[key]

    Always autofixable
  • RUF052

    Local dummy variable {} is accessed

    Some reports are autofixable
  • RUF053

    Class with type parameter list inherits from Generic

    Some reports are autofixable
  • RUF054

    Indented form feed

    No autofix
  • RUF055

    Plain string pattern passed to re function

    Some reports are autofixable
  • RUF056

    Avoid providing a falsy fallback to dict.get() in boolean test positions. The default fallback None is already falsy.

    Some reports are autofixable
  • RUF057

    Value being rounded is already an integer

    Always autofixable
  • RUF058

    itertools.starmap called on zip iterable

    Some reports are autofixable
  • RUF059

    Unpacked variable {name} is never used

    Some reports are autofixable
  • RUF060

    Unnecessary membership test on empty collection

    No autofix