Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

  • FURB118

    Use operator.{operator} instead of defining a {target}

    Some reports are autofixable
  • FURB122

    Use of {}.write in a for loop

    Always autofixable
  • FURB129

    Instead of calling readlines(), iterate over file object directly

    Always autofixable
  • FURB131

    Prefer clear over deleting a full slice

    Some reports are autofixable
  • FURB132

    Use {suggestion} instead of check and remove

    Always autofixable
  • FURB136

    Replace if expression with {min_max} call

    Some reports are autofixable
  • FURB140

    Use itertools.starmap instead of the generator

    Some reports are autofixable
  • FURB142

    Use of set.{}() in a for loop

    Always autofixable
  • FURB145

    Prefer copy method over slicing

    Always autofixable
  • FURB148

    enumerate value is unused, use for x in range(len(y)) instead

    Some reports are autofixable
  • FURB152

    Replace {literal} with math.{constant}

    Some reports are autofixable
  • FURB154

    Use of repeated consecutive {}

    Always autofixable
  • FURB156

    Use of hardcoded string charset

    Always autofixable
  • FURB157

    Verbose expression in Decimal constructor

    Always autofixable
  • FURB161

    Use of bin({existing}).count('1')

    Always autofixable
  • FURB162

    Unnecessary timezone replacement with zero offset

    Always autofixable
  • FURB163

    Prefer math.{log_function}({arg}) over math.log with a redundant base

    Some reports are autofixable
  • FURB164

    Verbose method {method_name} in {constructor} construction

    Some reports are autofixable
  • FURB166

    Use of int with explicit base={base} after removing prefix

    Always autofixable
  • FURB167

    Use of regular expression alias re.{}

    Always autofixable
  • FURB168

    Prefer is operator over isinstance to check if an object is None

    Always autofixable
  • FURB169

    When checking against None, use {} instead of comparison with type(None)

    Always autofixable
  • FURB171

    Membership test against single-item container

    Always autofixable
  • FURB177

    Prefer Path.cwd() over Path().resolve() for current-directory lookups

    Some reports are autofixable
  • FURB180

    Use of metaclass=abc.ABCMeta to define abstract base class

    Always autofixable
  • FURB181

    Use of hashlib's .digest().hex()

    Some reports are autofixable
  • FURB187

    Use of assignment of reversed on list {name}

    Always autofixable
  • FURB188

    Prefer str.removeprefix() over conditionally replacing with slice.

    Always autofixable
  • FURB189

    Subclassing {subclass} can be error prone, use collections.{replacement} instead

    Always autofixable
  • FURB192

    Prefer min over sorted() to compute the minimum value in a sequence

    Some reports are autofixable
  • G001

    Logging statement uses str.format

    No autofix
  • G002

    Logging statement uses %

    No autofix
  • G003

    Logging statement uses +

    No autofix
  • G004

    Logging statement uses f-string

    Some reports are autofixable
  • G010

    Logging statement uses warn instead of warning

    Always autofixable
  • G101

    Logging statement uses an extra field that clashes with a LogRecord field: {key}

    No autofix
  • G201

    Logging .exception(...) should be used instead of .error(..., exc_info=True)

    No autofix
  • G202

    Logging statement has redundant exc_info

    No autofix
  • I001

    Import block is un-sorted or un-formatted

    Some reports are autofixable
  • I002

    Missing required import: {name}

    Always autofixable