Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

  • PLR0133

    Two constants compared in a comparison, consider replacing {left_constant} {op} {right_constant}

    No autofix
  • PLR0202

    Class method defined without decorator

    Always autofixable
  • PLR0203

    Static method defined without decorator

    Always autofixable
  • PLR0206

    Cannot have defined parameters for properties

    No autofix
  • PLR0402

    Use from {module} import {name} in lieu of alias

    Some reports are autofixable
  • PLR0904

    Too many public methods ({methods} > {max_methods})

    No autofix
  • PLR0914

    Too many local variables ({current_amount} > {max_amount})

    No autofix
  • PLR0916

    Too many Boolean expressions ({expressions} > {max_expressions})

    No autofix
  • PLR0917

    Too many positional arguments ({c_pos} > {max_pos})

    No autofix
  • PLR1702

    Too many nested blocks ({nested_blocks} > {max_nested_blocks})

    No autofix
  • PLR1704

    Redefining argument with the local name {name}

    No autofix
  • PLR1708

    Explicit raise StopIteration in generator

    No autofix
  • PLR1711

    Useless return statement at end of function

    Always autofixable
  • PLR1712

    Unnecessary temporary variable

    Some reports are autofixable
  • PLR1714

    Consider merging multiple comparisons: {expression}. Use a set if the elements are hashable.

    Always autofixable
  • PLR1716

    Contains chained boolean comparison that can be simplified

    Always autofixable
  • PLR1722

    Use sys.exit() instead of {name}

    Some reports are autofixable
  • PLR1730

    Replace if statement with {replacement}

    Some reports are autofixable
  • PLR1733

    Unnecessary lookup of dictionary value by key

    Always autofixable
  • PLR1736

    List index lookup in enumerate() loop

    Always autofixable
  • PLR2004

    Magic value used in comparison, consider replacing {value} with a constant variable

    No autofix
  • PLR2044

    Line with empty comment

    Always autofixable
  • PLR5501

    Use elif instead of else then if, to reduce indentation

    Some reports are autofixable
  • PLR6104

    Use {operator} to perform an augmented assignment directly

    Always autofixable
  • PLR6201

    Use a set literal when testing for membership

    Always autofixable
  • PLW0108

    Lambda may be unnecessary; consider inlining inner function

    Some reports are autofixable
  • PLW0120

    else clause on loop without a break statement; remove the else and dedent its contents

    Some reports are autofixable
  • PLW0127

    Self-assignment of variable {name}

    No autofix
  • PLW0128

    Redeclared variable {name} in assignment

    No autofix
  • PLW0129

    Asserting on an empty string literal will never pass

    No autofix
  • PLW0131

    Named expression used without context

    No autofix
  • PLW0133

    Missing raise statement on exception

    Some reports are autofixable
  • PLW0177

    Comparing against a NaN value; use math.isnan instead

    No autofix
  • PLW0211

    First argument of a static method should not be named {argument_name}

    No autofix
  • PLW0244

    Slot {slot_name} redefined from base class {base}

    No autofix
  • PLW0245

    super call is missing parentheses

    Always autofixable
  • PLW0406

    Module {name} imports itself

    No autofix
  • PLW0602

    Using global for {name} but no assignment is done

    No autofix
  • PLW0603

    Using the global statement to update {name} is discouraged

    No autofix
  • PLW0604

    global at module level is redundant

    No autofix