Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

  • PLW0642

    Reassigned {} variable in {method_type} method

    No autofix
  • PLW0711

    Exception to catch is the result of a binary and operation

    No autofix
  • PLW0717

    Try clause contains too many statements ({statements} > {max_statements})

    No autofix
  • PLW1501

    {mode} is not a valid mode for open

    No autofix
  • PLW1507

    Shallow copy of os.environ via copy.copy(os.environ)

    Always autofixable
  • PLW1508

    Invalid type for environment variable default; expected str or None

    No autofix
  • PLW1509

    preexec_fn argument is unsafe when using threads

    No autofix
  • PLW1510

    subprocess.run without explicit check argument

    Some reports are autofixable
  • PLW1514

    {function_name} in text mode without explicit encoding argument

    Always autofixable
  • PLW1641

    Object does not implement __hash__ method

    No autofix
  • PLW2101

    Threading lock directly created in with statement has no effect

    No autofix
  • PLW2901

    Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target

    No autofix
  • PLW3201

    Dunder method {name} has no special meaning in Python 3

    No autofix
  • PLW3301

    Nested {func} calls can be flattened

    Some reports are autofixable
  • PT001

    Use @pytest.fixture{expected} over @pytest.fixture{actual}

    Always autofixable
  • PT002

    Configuration for fixture {function} specified via positional args, use kwargs

    No autofix
  • PT003

    scope='function' is implied in @pytest.fixture()

    Always autofixable
  • PT006

    Wrong type passed to first argument of pytest.mark.parametrize; expected {expected_string}

    Some reports are autofixable
  • PT007

    Wrong values type in pytest.mark.parametrize expected {values}

    Always autofixable
  • PT008

    Use return_value= instead of patching with lambda

    No autofix
  • PT009

    Use a regular assert instead of unittest-style {assertion}

    Some reports are autofixable
  • PT010

    Set the expected exception in pytest.raises()

    No autofix
  • PT011

    pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception

    No autofix
  • PT012

    pytest.raises() block should contain a single simple statement

    No autofix
  • PT013

    Incorrect import of pytest; use import pytest instead

    No autofix
  • PT014

    Duplicate of test case at index {index} in pytest.mark.parametrize

    Some reports are autofixable
  • PT015

    Assertion always fails, replace with pytest.fail()

    No autofix
  • PT016

    No message passed to pytest.fail()

    No autofix
  • PT017

    Found assertion on exception {name} in except block, use pytest.raises() instead

    No autofix
  • PT018

    Assertion should be broken down into multiple parts

    Some reports are autofixable
  • PT019

    Fixture {name} without value is injected as parameter, use @pytest.mark.usefixtures instead

    No autofix
  • PT020

    @pytest.yield_fixture is deprecated, use @pytest.fixture

    Some reports are autofixable
  • PT021

    Use yield instead of request.addfinalizer

    No autofix
  • PT022

    No teardown in fixture {name}, use return instead of yield

    Always autofixable
  • PT023

    Use @pytest.mark.{mark_name}{expected_parens} over @pytest.mark.{mark_name}{actual_parens}

    Always autofixable
  • PT024

    pytest.mark.asyncio is unnecessary for fixtures

    Always autofixable
  • PT025

    pytest.mark.usefixtures has no effect on fixtures

    Always autofixable
  • PT026

    Useless pytest.mark.usefixtures without parameters

    Always autofixable
  • PT027

    Use pytest.raises instead of unittest-style {assertion}

    Some reports are autofixable
  • PT028

    Test function parameter {} has default argument

    No autofix