blob: 5acb78ea3b1d2817944cdf1069aae0692bb9831c [file] [edit]
exclude = [
"**/_vendor",
"setuptools/_distutils",
"setuptools/config/_validate_pyproject",
]
[lint]
extend-select = [
# upstream
"C901", # complex-structure
"I", # isort
"PERF401", # manual-list-comprehension
"UP", # pyupgrade (Code modernization for strings, annotations, conditions, ...)
# Ensure modern type annotation syntax and best practices
# Not including those covered by type-checkers or exclusive to Python 3.11+
"FA", # flake8-future-annotations
"F404", # late-future-import
"PYI", # flake8-pyi
# local
"ANN2", # missing-return-type-*
"ISC", # flake8-implicit-str-concat
"FURB", # refurb
"PERF", # Perflint
"PIE", # flake8-pie
"PGH", # pygrep-hooks (blanket-* rules)
"PT", # flake8-pytest-style
"RUF10", # unused-noqa & redirected-noqa
"TRY", # tryceratops
"UP", # pyupgrade
"YTT", # flake8-2020
]
ignore = [
# upstream
"UP015", # redundant-open-modes, explicit is preferred
# Typeshed rejects complex or non-literal defaults for maintenance and testing reasons,
# irrelevant to this project.
"PYI011", # typed-argument-default-in-stub
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"D206",
"D300",
"COM812",
"COM819",
# N999 (invalid-module-name) yields false positives when a project's
# source directory is the distribution name and is redirected to a
# different import package (e.g. namespace layouts); the dotted directory
# name is itself a valid module. See
# https://github.com/astral-sh/ruff/issues/27801.
"N999",
# B008 is over-reaching; see jaraco/skeleton#214
"B008", # function-call-in-default-argument
# PLC0414 flags `import X as X`, the idiom type checkers recognize as an
# explicit re-export, and its fix (with F401) silently drops public names.
# See jaraco/skeleton#210.
"PLC0414", # useless-import-alias
# local
"PERF203", # try-except-in-loop, micro-optimisation with many false-positive. Worth checking but don't block CI
"PT007", # temporarily disabled, TODO: configure and standardize to preference
"PT011", # temporarily disabled, TODO: tighten expected error
"PT012", # pytest-raises-with-multiple-statements, avoid extra dummy methods for a few lines, sometimes we explicitly assert in case of no error
"TRY003", # raise-vanilla-args, avoid multitude of exception classes
"TRY301", # raise-within-try, it's handy
# Only enforcing return type annotations for public functions
"ANN202", # missing-return-type-private-function
]
[lint.flake8-comprehensions]
# Retain the elegant dict(a=1) keyword-call style; C408 still flags dict()
# and dict([...]). See jaraco/skeleton#210.
allow-dict-calls-with-keyword-arguments = true
[lint.per-file-ignores]
# Suppress nuisance warnings about module-import-not-at-top-of-file (E402) due to workaround for #4476
"setuptools/__init__.py" = ["E402"]
[lint.isort]
combine-as-imports = true
split-on-trailing-comma = false
# Force Ruff/isort to always import setuptools before distutils in tests as long as distutils_hack is supported
# This also ensures _distutils_hack is imported before distutils
# https://github.com/pypa/setuptools/issues/4137
section-order = ["future", "standard-library", "eager", "third-party", "first-party", "local-folder", "delayed"]
sections.eager = ["_distutils_hack"]
sections.delayed = ["distutils"]
[lint.flake8-annotations]
ignore-fully-untyped = true
[format]
# Enable preview to get hugged parenthesis unwrapping and other nice surprises
# See https://github.com/jaraco/skeleton/pull/133#issuecomment-2239538373
preview = true
# https://docs.astral.sh/ruff/settings/#format_quote-style
quote-style = "preserve"