Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 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
  • TRY201

    Use raise without specifying exception name

    Always autofixable
  • TRY203

    Remove exception handler; error is immediately re-raised

    No autofix
  • TRY300

    Consider moving this statement to an else block

    No autofix
  • TRY301

    Abstract raise to an inner function

    No autofix
  • TRY400

    Use logging.exception instead of logging.error

    Some reports are autofixable
  • TRY401

    Redundant exception object included in logging.exception call

    No autofix
  • UP001

    __metaclass__ = type is implied

    Always autofixable
  • UP003

    Use {} instead of type(...)

    Some reports are autofixable