Skip to content

Ruff

903 rules ruff@0.17.0

Complete effective rule inventory.

Docs

Rules

32 rules on this page · 903 total

  • 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
  • PT029

    Set the expected warning in pytest.warns()

    No autofix
  • PT030

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

    No autofix
  • PT031

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

    No autofix
  • PTH100

    os.path.abspath() should be replaced by Path.resolve()

    Some reports are autofixable
  • PTH101

    os.chmod() should be replaced by Path.chmod()

    Some reports are autofixable
  • PTH102

    os.mkdir() should be replaced by Path.mkdir()

    Some reports are autofixable
  • PTH103

    os.makedirs() should be replaced by Path.mkdir(parents=True)

    Some reports are autofixable
  • PTH104

    os.rename() should be replaced by Path.rename()

    Some reports are autofixable
  • PTH105

    os.replace() should be replaced by Path.replace()

    Some reports are autofixable
  • PTH106

    os.rmdir() should be replaced by Path.rmdir()

    Some reports are autofixable
  • PTH107

    os.remove() should be replaced by Path.unlink()

    Some reports are autofixable
  • PTH108

    os.unlink() should be replaced by Path.unlink()

    Some reports are autofixable
  • PTH109

    os.getcwd() should be replaced by Path.cwd()

    Some reports are autofixable
  • PTH110

    os.path.exists() should be replaced by Path.exists()

    Some reports are autofixable
  • PTH111

    os.path.expanduser() should be replaced by Path.expanduser()

    Some reports are autofixable
  • PTH112

    os.path.isdir() should be replaced by Path.is_dir()

    Some reports are autofixable
  • PTH113

    os.path.isfile() should be replaced by Path.is_file()

    Some reports are autofixable
  • PTH114

    os.path.islink() should be replaced by Path.is_symlink()

    Some reports are autofixable
  • PTH115

    os.readlink() should be replaced by Path.readlink()

    Some reports are autofixable
  • PTH116

    os.stat() should be replaced by Path.stat(), Path.owner(), or Path.group()

    Some reports are autofixable
  • PTH117

    os.path.isabs() should be replaced by Path.is_absolute()

    Some reports are autofixable
  • PTH118

    os.{module}.join() should be replaced by Path with / operator

    No autofix
  • PTH119

    os.path.basename() should be replaced by Path.name

    Some reports are autofixable
  • PTH120

    os.path.dirname() should be replaced by Path.parent

    Some reports are autofixable