-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathpyproject.toml
More file actions
112 lines (103 loc) · 4.65 KB
/
Copy pathpyproject.toml
File metadata and controls
112 lines (103 loc) · 4.65 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
[build-system]
requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"
[project]
name = "token-saver"
# Read from src/__init__.py, which installers/common.py:_read_version() already
# treats as the source of truth (it stamps the plugin manifests from it). The
# literal that used to live here was maintained by hand and stamped by nothing,
# so it was one forgotten edit away from disagreeing with every other manifest.
dynamic = ["version"]
requires-python = ">=3.10"
[project.optional-dependencies]
dev = ["pytest", "pytest-cov", "mypy"]
[tool.setuptools.dynamic]
version = { attr = "src.__version__" }
# Flat layout with two top-level packages: name them rather than relying on
# auto-discovery, which errors out on ambiguity in newer setuptools.
[tool.setuptools]
packages = ["src", "src.processors", "installers"]
[tool.ruff]
target-version = "py310"
line-length = 100
[tool.ruff.lint]
# Preview is enabled *for the linter only* — at [tool.ruff] level it also
# switches the formatter to its preview style, which reformats 10 files for no
# reason. `explicit-preview-rules` then narrows it to preview rules named
# below and nothing else; enabling them all surfaces ~300 unrelated findings.
preview = true
explicit-preview-rules = true
select = [
# open() in text mode without encoding= uses the *locale* encoding, which is
# cp1252 on Windows. This broke the Windows CI job the first time it ran:
# reading a UTF-8 test file raised UnicodeDecodeError. Preview-only, hence
# the `preview = true` above.
"PLW1514",
"F", # Pyflakes — unused imports, undefined names, etc.
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort — import ordering
"N", # pep8-naming
"UP", # pyupgrade — modern Python syntax
"B", # flake8-bugbear — common bugs and design issues
"A", # flake8-builtins — shadowing builtins
"COM", # flake8-commas — trailing commas
"C4", # flake8-comprehensions — better comprehensions
"T10", # flake8-debugger — no leftover breakpoints
"ISC", # flake8-implicit-str-concat
"PIE", # flake8-pie — misc lints
"PT", # flake8-pytest-style
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self — private member access
"SIM", # flake8-simplify
"TCH", # flake8-type-checking — move imports to TYPE_CHECKING
"ARG", # flake8-unused-arguments
"ERA", # eradicate — commented-out code
"PL", # Pylint subset
"PERF", # Perflint — performance anti-patterns
"RUF", # Ruff-specific rules
"S", # flake8-bandit — security
]
ignore = [
"COM812", # missing trailing comma — conflicts with formatter
"ISC001", # single-line implicit string concat — conflicts with formatter
"S101", # assert in tests is fine
"PLR2004", # magic values in comparisons — too noisy for thresholds/processors
"PLR0912", # too many branches — some processors are inherently complex
"PLR0913", # too many arguments — shared utilities need flexible signatures
"PLR0911", # too many return statements
"PLR0915", # too many statements
"SIM108", # ternary instead of if/else — less readable for multi-line
"RET505", # unnecessary else after return — often clearer with else
"RET504", # unnecessary assignment before return — clearer with named var
"PT009", # use pytest.raises — we use assertEqual style too
"ARG002", # unused method argument — processors have fixed signatures
"N802", # function name should be lowercase — test methods like test_XXX_YYY
"SLF001", # private member access — needed in tests
"PERF401", # list.extend/comprehension — less readable in test data builders
"RUF012", # mutable class var without ClassVar — not using dataclasses
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # assert is the point of tests
"ARG", # unused arguments common in test fixtures
"PLR", # complexity rules too strict for test code
"SLF001", # private member access needed in tests
"S108", # /tmp usage in test assertions is fine
"PLC0415", # imports in test functions are intentional
"PERF401", # readability over perf in tests
]
"installers/**/*.py" = [
"S103", # chmod +x on the CLI binary is intentional
]
"scripts/audit_compression.py" = [
"E501", # long lines in test data builders
"PERF401", # readability over perf in data builders
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true
[tool.pytest.ini_options]
testpaths = ["tests"]