Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

  • PD004

    .notna is preferred to .notnull; functionality is equivalent

    No autofix
  • PD007

    .ix is deprecated; use more explicit .loc or .iloc

    No autofix
  • PD008

    Use .loc instead of .at. If speed is important, use NumPy.

    No autofix
  • PD009

    Use .iloc instead of .iat. If speed is important, use NumPy.

    No autofix
  • PD010

    .pivot_table is preferred to .pivot or .unstack; provides same functionality

    No autofix
  • PD011

    Use .to_numpy() or .array instead of .values

    No autofix
  • PD012

    Use .read_csv instead of .read_table to read CSV files

    No autofix
  • PD013

    .melt is preferred to .stack; provides same functionality

    No autofix
  • PD015

    Use .merge method instead of pd.merge function. They have equivalent functionality.

    No autofix
  • PD101

    Using series.nunique() for checking that a series is constant is inefficient

    No autofix
  • PERF101

    Do not cast an iterable to list before iterating over it

    Always autofixable
  • PERF102

    When using only the {subset} of a dict use the {subset}() method

    Always autofixable
  • PERF203

    try-except within a loop incurs performance overhead

    No autofix
  • PERF401

    Use {message_str} to create a transformed list

    Some reports are autofixable
  • PERF402

    Use list or list.copy to create a copy of a list

    No autofix
  • PERF403

    Use a dictionary comprehension instead of {modifier} for-loop

    Some reports are autofixable
  • PGH003

    Use specific rule codes when ignoring type issues

    No autofix
  • PGH004

    Use specific rule codes when using noqa

    Some reports are autofixable
  • PGH005

    Mock method should be called: {name}

    No autofix
  • PIE790

    Unnecessary pass statement

    Always autofixable
  • PIE794

    Class field {name} is defined multiple times

    Always autofixable
  • PIE796

    Enum contains duplicate value: {value}

    No autofix
  • PIE800

    Unnecessary spread **

    Some reports are autofixable
  • PIE804

    Unnecessary dict kwargs

    Some reports are autofixable
  • PIE807

    Prefer {container} over useless lambda

    Some reports are autofixable
  • PIE808

    Unnecessary start argument in range

    Always autofixable
  • PIE810

    Call {attr} once with a tuple

    Always autofixable
  • PLC0105

    {kind} name "{param_name}" does not reflect its {variance}; consider renaming it to "{replacement_name}"

    No autofix
  • PLC0131

    {kind} cannot be both covariant and contravariant

    No autofix
  • PLC0132

    {kind} name {param_name} does not match assigned variable name {var_name}

    No autofix
  • PLC0205

    Class __slots__ should be a non-string iterable

    No autofix
  • PLC0206

    Extracting value from dictionary without calling .items()

    No autofix
  • PLC0207

    String is split more times than necessary

    Always autofixable
  • PLC0208

    Use a sequence type instead of a set when iterating over values

    Always autofixable
  • PLC0415

    import should be at the top-level of a file

    No autofix
  • PLC1802

    len({expression}) used as condition without comparison

    Always autofixable
  • PLC1901

    {existing} can be simplified to {replacement} as an empty string is falsey

    No autofix
  • PLC2401

    {kind} name {name} contains a non-ASCII character

    No autofix
  • PLC2403

    Module alias {name} contains a non-ASCII character

    No autofix
  • PLC2801

    Unnecessary dunder call to {method}. {replacement}.

    Some reports are autofixable