Skip to content

Ruff

903 rules ruff@0.17.0

Complete effective rule inventory.

Docs

Rules

32 rules on this page · 903 total

  • E305

    Expected 2 blank lines after class or function definition, found ({blank_lines})

    Always autofixable
  • E306

    Expected 1 blank line before a nested definition, found 0

    Always autofixable
  • E401

    Multiple imports on one line

    Always autofixable
  • E402

    Module level import not at top of cell

    Some reports are autofixable
  • E502

    Redundant backslash

    Always autofixable
  • E701

    Multiple statements on one line (colon)

    No autofix
  • E702

    Multiple statements on one line (semicolon)

    No autofix
  • E703

    Statement ends with an unnecessary semicolon

    Always autofixable
  • E711

    Comparison to None should be cond is None

    Always autofixable
  • E712

    Avoid equality comparisons to True; use {cond}: for truth checks

    Always autofixable
  • E713

    Test for membership should be not in

    Always autofixable
  • E714

    Test for object identity should be is not

    Always autofixable
  • E721

    Use is and is not for type comparisons, or isinstance() for isinstance checks

    No autofix
  • E722

    Do not use bare except

    No autofix
  • E731

    Do not assign a lambda expression, use a def

    Some reports are autofixable
  • E741

    Ambiguous variable name: {name}

    No autofix
  • E742

    Ambiguous class name: {name}

    No autofix
  • E743

    Ambiguous function name: {name}

    No autofix
  • E902

    {message}

    No autofix
  • EM101

    Exception must not use a string literal, assign to variable first

    Some reports are autofixable
  • EM102

    Exception must not use an f-string literal, assign to variable first

    Some reports are autofixable
  • EM103

    Exception must not use a .format() string directly, assign to variable first

    Some reports are autofixable
  • EXE001

    Shebang is present but file is not executable

    No autofix
  • EXE002

    The file is executable but no shebang is present

    No autofix
  • EXE003

    Shebang should contain python, pytest, or uv run

    No autofix
  • EXE004

    Avoid whitespace before shebang

    Always autofixable
  • EXE005

    Shebang should be at the beginning of the file

    No autofix
  • F401

    {name} imported but unused; consider using importlib.util.find_spec to test for availability

    Some reports are autofixable
  • F402

    Import {name} from {row} shadowed by loop variable

    No autofix
  • F403

    from {name} import * used; unable to detect undefined names

    No autofix
  • F404

    from __future__ imports must occur at the beginning of the file

    No autofix
  • F405

    {name} may be undefined, or defined from star imports

    No autofix