Skip to content

Instantly share code, notes, and snippets.

@cutwater
Last active February 8, 2025 09:24
Show Gist options
  • Save cutwater/8b982b425d52996d6dccc8b87c6ee75d to your computer and use it in GitHub Desktop.
Save cutwater/8b982b425d52996d6dccc8b87c6ee75d to your computer and use it in GitHub Desktop.
Ruff config (legacy project)
[tool.ruff.lint]
select = [
# pyflakes
"F",
# pycodestyle errors
"E",
# pycodestyle warnings
"W",
# flake8-builtins
"A",
# flake8-bugbear
"B",
# flake8-comprehensions
"C4",
# flake8-commas
"COM",
# flake8-datetime
"DTZ",
# flake8-import-conventions
"ICN",
# flake8-executable
"EXE",
# flake8-no-pep420
"INP",
# flake8-logging
"LOG",
# pyupgrade
"UP",
# flake8-pie
"PIE",
# flake8-pytest-style
"PT",
# flake8-pyi
"PYI",
# ruff specific rules
"RUF",
# flake8-simplify
"SIM",
# flake8-debugger
"T10",
# flake8-todos
"TD"
]
extend-ignore = [
# B904 requires using `raise ... from ...` to explicitly tell what to do with "parent"
# exception. Would be nice to fix, but ignoring for now.
"B904",
# COM812 Trailing comma missing
# Incompatible with black
"COM812",
# UP032 Use f-string instead of `format` call.
# No need to replace all str.format usage with f-strings in entire codebase.
"UP032",
# PT004,PT005 are incorrect and deprecated
# See https://github.com/astral-sh/ruff/issues/8796
"PT004",
"PT005",
# PT009 Use a regular `assert` instead of unittest-style
# PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
# Ignoring, since we have mixed pytest and legacy unittest styled tests
"PT009",
"PT027",
# RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
# We don't enforce type annotations at the moment.
"RUF012",
# TD001 Invalid TODO tag
# We use TODO, FIXME and REVIEW tags
"TD001",
# TD003 Missing issue link on the line following this TODO
# We don't create issues for TODOs
"TD003",
]
[tool.ruff.lint.per-file-ignores]
# The `pkgname` is the only top-level package.
"!pkgname/**" = ["INP"]
[tool.ruff.lint.flake8-builtins]
# `license()` buit-in function is added by the site module.
builtins-ignorelist = ["id", "dir", "license"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment