Skip to content

Ruff

903 rules ruff@0.17.0

Complete effective rule inventory.

Docs

Rules

32 rules on this page · 903 total

  • 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 in a stub file must be a simple comparison against sys.platform or sys.version_info

    No autofix
  • PYI003

    Unrecognized sys.version_info check

    No autofix
  • PYI004

    Version comparison must use only major and minor version

    No autofix
  • PYI005

    Version comparison must be against a length-{expected_length} tuple

    No autofix
  • PYI006

    Use < or >= for sys.version_info comparisons

    No autofix
  • PYI007

    Unrecognized sys.platform check

    No autofix
  • PYI008

    Unrecognized platform {platform}

    No autofix
  • PYI009

    Empty body should contain ..., not pass

    Always autofixable
  • PYI010

    Function body must contain only ...

    Always autofixable
  • PYI011

    Only simple default values allowed for typed arguments

    Always autofixable
  • PYI012

    Class body must not contain pass

    Always autofixable
  • PYI013

    Non-empty class body must not contain ...

    Always autofixable
  • PYI014

    Only simple default values allowed for arguments

    Always autofixable
  • PYI015

    Only simple default values allowed for assignments

    Always autofixable
  • PYI016

    Duplicate union member {}

    Some reports are autofixable
  • PYI017

    Stubs should not contain assignments to attributes or multiple targets

    No autofix
  • PYI018

    Private {type_var_like_kind} {type_var_like_name} is never used

    Always autofixable