Skip to content

Ruff

902 rules ruff@0.16.8

Complete effective rule inventory.

Docs

Rules

40 rules on this page · 902 total

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

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

    Some reports are autofixable
  • PTH122

    os.path.splitext() should be replaced by Path.suffix, Path.stem, and Path.parent

    No autofix
  • PTH123

    open() should be replaced by Path.open()

    Some reports are autofixable
  • PTH124

    py.path is in maintenance mode, use pathlib instead

    No autofix
  • PTH201

    Do not pass the current directory explicitly to Path

    Always autofixable
  • PTH202

    os.path.getsize should be replaced by Path.stat().st_size

    Some reports are autofixable
  • PTH203

    os.path.getatime should be replaced by Path.stat().st_atime

    Some reports are autofixable
  • PTH204

    os.path.getmtime should be replaced by Path.stat().st_mtime

    Some reports are autofixable
  • PTH205

    os.path.getctime should be replaced by Path.stat().st_ctime

    Some reports are autofixable
  • PTH206

    Replace .split(os.sep) with Path.parts

    No autofix
  • PTH207

    Replace {function} with Path.glob or Path.rglob

    No autofix
  • PTH208

    Use pathlib.Path.iterdir() instead.

    Some reports are autofixable
  • PTH210

    Invalid suffix passed to .with_suffix()

    Some reports are autofixable
  • PTH211

    os.symlink should be replaced by Path.symlink_to

    Some reports are autofixable
  • PYI001

    Name of private {kind} must start with _

    No autofix
  • PYI002

    if test must be a simple comparison against sys.platform or sys.version_info

    No autofix