Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

  • B033

    Sets should not contain duplicate item {value}

    Some reports are autofixable
  • B034

    {method} should pass {param_name} and flags as keyword arguments to avoid confusion due to unintuitive argument positions

    No autofix
  • B035

    Dictionary comprehension uses static key: {key}

    No autofix
  • B039

    Do not use mutable data structures for ContextVar defaults

    No autofix
  • B043

    Do not call delattr with a constant attribute value. It is not any safer than normal property deletion.

    Always autofixable
  • B901

    Using yield and return {value} in a generator function can lead to confusing behavior

    No autofix
  • B903

    Class could be dataclass or namedtuple

    No autofix
  • B904

    Within an except* clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

    No autofix
  • B905

    zip() without an explicit strict= parameter

    Always autofixable
  • B909

    Mutation to loop iterable {name} during iteration

    No autofix
  • B911

    itertools.batched() without an explicit strict parameter

    No autofix
  • B912

    map() without an explicit strict= parameter

    Always autofixable
  • BLE001

    Do not catch blind exception: {name}

    No autofix
  • C400

    Unnecessary generator (rewrite using list())

    Always autofixable
  • C401

    Unnecessary generator (rewrite using set())

    Always autofixable
  • C402

    Unnecessary generator (rewrite as a dict comprehension)

    Always autofixable
  • C403

    Unnecessary list comprehension (rewrite as a set comprehension)

    Always autofixable
  • C404

    Unnecessary list comprehension (rewrite as a dict comprehension)

    Always autofixable
  • C405

    Unnecessary {kind} literal (rewrite as a set literal)

    Always autofixable
  • C406

    Unnecessary {obj_type} literal (rewrite as a dict literal)

    Always autofixable
  • C408

    Unnecessary {kind}() call (rewrite as a literal)

    Always autofixable
  • C409

    Unnecessary list literal passed to tuple() (rewrite as a tuple literal)

    Some reports are autofixable
  • C410

    Unnecessary list literal passed to list() (remove the outer call to list())

    Always autofixable
  • C411

    Unnecessary list() call (remove the outer call to list())

    Some reports are autofixable
  • C413

    Unnecessary {func}() call around sorted()

    Always autofixable
  • C414

    Unnecessary {inner}() call within {outer}()

    Always autofixable
  • C415

    Unnecessary subscript reversal of iterable within {func}()

    No autofix
  • C416

    Unnecessary {kind} comprehension (rewrite using {kind}())

    Always autofixable
  • C417

    Unnecessary map() usage (rewrite using a {object_type})

    Some reports are autofixable
  • C418

    Unnecessary dict {kind} passed to dict() (remove the outer call to dict())

    Some reports are autofixable
  • C419

    Unnecessary list comprehension

    Some reports are autofixable
  • C420

    Unnecessary dict comprehension for iterable; use dict.fromkeys instead

    Some reports are autofixable
  • COM818

    Trailing comma on bare tuple prohibited

    No autofix
  • COM819

    Trailing comma prohibited

    Always autofixable
  • D201

    No blank lines allowed before function docstring (found {num_lines})

    Some reports are autofixable
  • D202

    No blank lines allowed after function docstring (found {num_lines})

    Some reports are autofixable
  • D204

    1 blank line required after class docstring

    Always autofixable
  • D206

    Docstring should be indented with spaces, not tabs

    No autofix
  • D207

    Docstring is under-indented

    Always autofixable
  • D208

    Docstring is over-indented

    Always autofixable