piker/ruff.toml

121 lines
3.0 KiB
TOML

# from default `ruff.toml` @
# https://docs.astral.sh/ruff/configuration/
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
# Same as Black.
line-length = 88
indent-width = 4
# !XXX sync with `pyproject.toml`!
target-version = "py312"
# ------ - ------
# TODO, stop warnings around `anext()` builtin use?
# tool.ruff.target-version = "py310"
[lint]
select = [
# pycodestyle error subsets (pre-existing)
"E4", "E7", "E9",
# pyflakes (pre-existing)
"F",
# -- pydocstyle: enforce piker's ''' multiline style --
# D2xx whitespace and formatting rules; most are
# auto-fixable via `ruff check --fix`.
# NOTE: D1xx (missing-docstring) rules intentionally
# excluded to avoid noise across the existing codebase.
"D2",
# D4xx content checks (cherry-picked)
"D402", # first line != function signature
"D403", # capitalize first word
"D419", # no empty docstrings
# NOTE: D3xx skipped entirely since D300 enforces
# triple-double-quotes `"""` which conflicts with
# piker's `'''` convention (the formatter's
# `quote-style = "single"` handles conversion).
# pycodestyle warnings
"W",
]
ignore = [
# -- pydocstyle ignores for piker conventions --
# piker ALWAYS uses multiline docstring style, never
# single-line, so disable the "fit on one line" rule.
"D200",
# piker uses NO blank line before class docstrings
# (D211) not 1-blank-line (D203); these conflict.
"D203",
# piker puts the summary on the SECOND line after
# an opening `'''` (D213); not on the same line as
# the opening quotes (D212); these conflict.
"D212",
]
ignore-init-module-imports = false
[lint.per-file-ignores]
"piker/ui/qt.py" = [
"E402",
'F401', # unused imports (without __all__ or blah as blah)
# "F841", # unused variable rules
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# TODO? uhh why no work!?
# Allow unused variables when underscore-prefixed.
# dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[format]
# Use single quotes in `ruff format`.
quote-style = "single"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Auto-format code examples inside docstrings
# (>>> blocks, code fences, etc.)
docstring-code-format = true
# Use piker's 67-char target for code inside docstrings
# (only applies when `docstring-code-format = true`).
docstring-code-line-length = 67