-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff.toml
More file actions
150 lines (133 loc) · 3.91 KB
/
Copy pathruff.toml
File metadata and controls
150 lines (133 loc) · 3.91 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Ruff configuration
# https://docs.astral.sh/ruff/configuration/
# Target Python version
target-version = "py311"
# Line length
line-length = 100
# Exclude common directories
exclude = [
".git",
".github",
".mypy_cache",
".pytest_cache",
".ruff_cache",
".tox",
".venv",
"venv",
"__pypackages__",
"_build",
"build",
"dist",
"node_modules",
".next",
".turbo",
"alembic/versions",
]
# Fix violations automatically when possible
fix = true
# Show fixes in output
show-fixes = true
[lint]
# Enable specific rule sets
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"EXE", # flake8-executable
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate (commented-out code)
"PL", # Pylint
"TRY", # tryceratops
"FLY", # flynt
"PERF", # Perflint
"FURB", # refurb
"LOG", # flake8-logging
"RUF", # Ruff-specific rules
"S", # flake8-bandit (security)
]
# Ignore specific rules
ignore = [
"E501", # Line too long (handled by formatter)
"PLR0913", # Too many arguments
"PLR2004", # Magic value comparison
"TRY003", # Avoid long messages in exceptions
"ISC001", # Conflicts with formatter
# UP042: `class X(str, Enum)` -> `enum.StrEnum`. Suppressed because StrEnum
# changes `str(X.A)` semantics (returns the value, not the qualified name)
# and the codebase has 27+ existing classes using the (str, Enum) pattern.
# Migration is a behavioral change disguised as a lint fix; defer to a
# focused PR with explicit per-class testing.
"UP042",
]
# Allow fix for all enabled rules
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[lint.per-file-ignores]
# Tests can have magic values, unused arguments, asserts, and subprocess calls
"**/tests/**/*.py" = ["PLR2004", "ARG001", "ARG002", "S101", "S603", "S607"]
# Init files can have unused imports
"**/__init__.py" = ["F401", "F403"]
# Migrations can be messy
"**/alembic/versions/*.py" = ["ALL"]
# Scripts might have prints
"**/scripts/*.py" = ["T201"]
# ML/data code follows sklearn conventions (X for feature matrix), needs runtime pandas/sklearn imports
"src/label-derivation-spike/**/*.py" = ["N803", "N806"]
[lint.isort]
# isort configuration
known-first-party = ["app"]
combine-as-imports = true
force-wrap-aliases = true
split-on-trailing-comma = true
[lint.flake8-quotes]
# Prefer double quotes
inline-quotes = "double"
docstring-quotes = "double"
[lint.flake8-tidy-imports]
# Ban relative imports
ban-relative-imports = "all"
[lint.flake8-type-checking]
# Move imports to TYPE_CHECKING block when only used for annotations
strict = true
[lint.pylint]
# Maximum number of branches in a function
max-branches = 12
# Maximum number of returns in a function
max-returns = 6
# Maximum number of statements in a function
max-statements = 50
[lint.mccabe]
# Maximum complexity
max-complexity = 10
[format]
# Format configuration
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"