Skip to content

Ruff

903 rules ruff@0.17.0

Complete effective rule inventory.

Docs

Rules

32 rules on this page · 903 total

  • SIM401

    Use {contents} instead of an if block

    Some reports are autofixable
  • SIM905

    Consider using a list literal instead of str.{}

    Some reports are autofixable
  • SIM910

    Use {expected} instead of {actual}

    Always autofixable
  • SIM911

    Use {expected} instead of {actual}

    Always autofixable
  • SLF001

    Private member accessed: {access}

    No autofix
  • SLOT000

    Subclasses of str should define __slots__

    No autofix
  • SLOT001

    Subclasses of tuple should define __slots__

    No autofix
  • SLOT002

    Subclasses of {namedtuple_kind} should define __slots__

    No autofix
  • T100

    Trace found: {name} used

    No autofix
  • T201

    print found

    Some reports are autofixable
  • T203

    pprint found

    Some reports are autofixable
  • TC001

    Move application import {} into a type-checking block

    Some reports are autofixable
  • TC002

    Move third-party import {} into a type-checking block

    Some reports are autofixable
  • TC003

    Move standard library import {} into a type-checking block

    Some reports are autofixable
  • TC004

    Move import {qualified_name} out of type-checking block. Import is used for more than type hinting.

    Some reports are autofixable
  • TC005

    Found empty type-checking block

    Always autofixable
  • TC006

    Add quotes to type expression in typing.cast()

    Always autofixable
  • TC007

    Add quotes to type alias

    Always autofixable
  • TC008

    Remove quotes from type alias

    Always autofixable
  • TC010

    Invalid string member in X | Y-style union type

    No autofix
  • TD001

    Invalid TODO tag: {tag}

    No autofix
  • TD005

    Missing issue description after TODO

    No autofix
  • TD006

    Invalid TODO capitalization: {tag} should be TODO

    Always autofixable
  • TD007

    Missing space after colon in TODO

    No autofix
  • TID251

    {name} is banned: {message}

    No autofix
  • TID252

    Prefer absolute imports over relative imports from parent modules

    Some reports are autofixable
  • TID253

    {name} is banned at the module level

    No autofix
  • TID254

    {name} should be imported lazily

    Some reports are autofixable
  • TID255

    Lazy import {name} is resolved immediately

    Some reports are autofixable
  • TRY002

    Create your own exception

    No autofix
  • TRY003

    Avoid specifying long messages outside the exception class

    No autofix
  • TRY004

    Prefer TypeError exception for invalid type

    No autofix