-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff.strict.toml
More file actions
73 lines (67 loc) · 2.53 KB
/
ruff.strict.toml
File metadata and controls
73 lines (67 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# ============================================================
# ruff.strict.toml (Stricter Ruff linter configuration)
# ============================================================
#
# IMPORTANT:
# - This file is OPTIONAL.
# - It EXTENDS (does not replace) the [tool.ruff] configuration in pyproject.toml.
# - CI should enforce ONLY the pyproject.toml rules unless you explicitly opt in.
#
# PURPOSE:
# - Adds docstring checks (D) and security checks (S)
# - Adds maintainability/refactor lint categories (PTH, C4, SIM, RET)
#
# WHO SHOULD USE THIS:
# - Maintainers before publishing template updates
# - Anyone who wants a higher quality bar locally
#
# RELATIONSHIP TO OTHER CONFIG FILES:
# - pyproject.toml defines baseline Ruff rules (used by CI and pre-commit).
# - ruff.strict.toml EXTENDS those rules with additional, opt-in checks.
# - Pre-commit hooks (if enabled) use ONLY the pyproject.toml config
# UNLESS explicitly told to use this strict config.
# - Running Ruff with --config ruff.strict.toml MERGES this file
# with the base configuration; it does NOT replace it.
#
# RUN (from the repo root):
# uv run ruff check --config ruff.strict.toml .
# uv run ruff check --config ruff.strict.toml --fix .
#
# OPTIONAL MAINTAINER CHECKS (if installed in this repo):
# uv run pyright
# uv run bandit -c pyproject.toml -r src
# uv run validate-pyproject pyproject.toml
[format]
# WHY: Enforce consistent quote style to minimize diffs.
quote-style = "double"
[lint]
# Baseline + stricter categories:
select = [
"E", # Basic syntax and structural correctness
"F", # Undefined names and unused imports
"W", # Warnings that catch easy issues early
"I", # Deterministic import ordering
"UP", # Modern Python constructs
"B", # Common bug patterns
"PTH", # Prefer pathlib patterns
"C4", # Comprehension correctness and clarity
"SIM", # Simplify obvious complexity
"RET", # Return practices
"D", # Docstring standards (see convention below)
"S", # Security checks (with deliberate exceptions)
]
ignore = [
"E501", # line length handled by formatter
"D203", # conflicts with D211
"D213", # conflicts with D212 (Google standard summary placement)
"S101", # allow assert (tests + internal invariants)
]
[lint.per-file-ignores]
# WHY: Some files MUST NOT undergo linting or automated fixes.
"**/__init__.py" = ["D104", "F401"]
"tests/**/*.py" = ["D", "B018", "B011", "S101"]
"src/**/py.typed" = ["ALL"]
"**/*.log" = ["ALL"]
[lint.pydocstyle]
# Choose docstring convention to avoid churn.
convention = "google"