Skip to content

Ruff

903 rules ruff@0.17.0

Complete effective rule inventory.

Docs

Rules

32 rules on this page · 903 total

  • ARG005

    Unused lambda argument: {name}

    No autofix
  • ASYNC100

    A with {method_name}(...): context does not contain any await statements. This makes it pointless, as the timeout can only be triggered by a checkpoint.

    No autofix
  • ASYNC105

    Call to {method_name} is not immediately awaited

    Some reports are autofixable
  • ASYNC109

    Async function definition with a timeout parameter

    No autofix
  • ASYNC110

    Use {module}.Event instead of awaiting {module}.sleep in a while loop

    No autofix
  • ASYNC115

    Use {module}.lowlevel.checkpoint() instead of {module}.sleep(0)

    Always autofixable
  • ASYNC116

    {module}.sleep() with >24 hour interval should usually be {module}.sleep_forever()

    Some reports are autofixable
  • ASYNC119

    Yield in context manager in async generator may not trigger cleanup

    No autofix
  • ASYNC210

    Async functions should not call blocking HTTP methods

    No autofix
  • ASYNC212

    Blocking httpx method {name}.{call}() in async context, use httpx.AsyncClient

    No autofix
  • ASYNC220

    Async functions should not create subprocesses with blocking methods

    No autofix
  • ASYNC221

    Async functions should not run processes with blocking methods

    No autofix
  • ASYNC222

    Async functions should not wait on processes with blocking methods

    No autofix
  • ASYNC230

    Async functions should not open files with blocking methods like open

    No autofix
  • ASYNC240

    Async functions should not perform blocking {path_library} operations

    No autofix
  • ASYNC250

    Blocking call to input() in async context

    No autofix
  • ASYNC251

    Async functions should not call time.sleep

    No autofix
  • B002

    Python does not support the unary prefix increment operator (++)

    No autofix
  • B003

    Assigning to os.environ doesn't clear the environment

    No autofix
  • B004

    Using hasattr(x, "__call__") to test if x is callable is unreliable. Use callable(x) for consistent results.

    Some reports are autofixable
  • B005

    Using .{strip}() with multi-character strings is misleading

    No autofix
  • B006

    Do not use mutable data structures for argument defaults

    Some reports are autofixable
  • B007

    Loop control variable {name} not used within loop body

    Some reports are autofixable
  • B008

    Do not perform function call {name} in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

    No autofix
  • B009

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

    Always autofixable
  • B010

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

    Always autofixable
  • B011

    Do not assert False (python -O removes these calls), raise AssertionError()

    Always autofixable
  • B012

    {name} inside finally blocks cause exceptions to be silenced

    No autofix
  • B013

    A length-one tuple literal is redundant in exception handlers

    Always autofixable
  • B014

    Exception handler with duplicate exception: {name}

    Always autofixable
  • B015

    Pointless comparison. Did you mean to assign a value? Otherwise, prepend assert or remove it.

    No autofix
  • B016

    Cannot raise a literal. Did you intend to return it or raise an Exception?

    No autofix