Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
50 lines (46 loc) · 1.68 KB
/
Copy pathpyproject.toml
File metadata and controls
50 lines (46 loc) · 1.68 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
[tool.ruff]
target-version = "py312"
line-length = 88
exclude = [
"node_modules",
"third_party",
".venv",
"reference",
"lib/image/generated",
]
[tool.ruff.lint]
select = [
"F", # pyflakes (unused imports, undefined names, etc.)
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort (import sorting)
"UP", # pyupgrade (modern Python idioms)
"B", # flake8-bugbear (common bugs)
"SIM", # flake8-simplify
"RUF", # ruff-specific rules
]
ignore = [
"E501", # line too long — handled by formatter
"SIM105", # contextlib.suppress — verbose for test try/except patterns
"SIM108", # ternary operator — often less readable in test assertions
"SIM115", # open-file-with-context-handler — not always practical
"RUF005", # collection concatenation — existing patterns are clear
"RUF012", # mutable class default — false positive on read-only test constants
"UP038", # isinstance tuple → union — tuple form is clearer
"RUF059", # unused unpacked variable — common in test tuple unpacking
]
# Auto-fix unused imports and sort imports on save/commit
fixable = ["F401", "I001", "UP", "RUF"]
[tool.ruff.lint.per-file-ignores]
# Test files: allow unused variables (cache-warming side effects),
# unused loop vars, imports not at top (conditional/fixture imports)
"test_*.py" = ["F841", "B007", "E402"]
"conftest.py" = ["F841", "B007", "E402"]
# Origin servers and generators have intentional patterns
"**/origin*.py" = ["F841", "E402"]
"**/generate*.py" = ["E402"]
[tool.ruff.lint.isort]
known-first-party = ["pagespeed"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"