Repository navigation
Expand file tree
/
Copy pathruff.toml
More file actions
112 lines (101 loc) · 4.16 KB
/
Copy pathruff.toml
File metadata and controls
112 lines (101 loc) · 4.16 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
# file: ruff.toml
# version: 1.4.0
# guid: f1a2b3c4-d5e6-789f-a012-456789abcdef
# last-edited: 2026-10-16
# Ruff configuration following Google Python Style Guide
# https://google.github.io/styleguide/pyguide.html
target-version = "py39"
line-length = 80
indent-width = 4
[lint]
# Enable comprehensive linting rules
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"N", # pep8-naming
"D", # pydocstyle
"S", # flake8-bandit (security)
"T20", # flake8-print
"PL", # pylint
"RUF", # ruff-specific rules
"A", # flake8-builtins
"C90", # mccabe complexity
"ERA", # eradicate (dead code)
"ICN", # flake8-import-conventions
"PIE", # flake8-pie
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"ARG", # flake8-unused-arguments
]
ignore = [
"E501", # line too long, handled by formatter
"B008", # do not perform function calls in argument defaults
"C901", # too complex (handled by C90)
# ERA001 (commented-out code) cannot coexist with this repo's mandatory
# `# file:` / `# version:` / `# guid:` header block — it flags the header on
# every Python file (37 files today), and its autofix DELETES it. The header
# rule wins; ERA001 is off. See .standards/instructions/file-headers.md.
"ERA001",
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D203", # 1 blank line required before class docstring (conflicts with D211)
"D213", # Multi-line docstring summary should start at the second line (conflicts with D212)
"PLR0913", # Too many arguments to function call
"PLR0912", # Too many branches
"PLR0915", # Too many statements
]
[lint.per-file-ignores]
"__init__.py" = ["F401", "D104"]
# Rules that do not apply to test code:
# S101/S106 - asserts and fake credentials ("token") are the point of a test
# D100-D107 - test doubles like DummyResponse do not need docstrings
# PLR2004 - magic numbers in assertions are clearer inline
# ARG001/ARG005- stub signatures must mirror the real callee even when the
# test ignores an argument (**kwargs on a fake subprocess.run)
# PT009 - tests/test_basic.py is deliberately unittest.TestCase-style
# PLC0415 - a test that asserts stdlib imports work must import inline
# RUF001 - tests assert on the exact emoji (ℹ️, ❌) the scripts print
# Keep these two lists identical.
"test_*.py" = ["S101", "S106", "D100", "D101", "D102", "D103", "D107", "PLR2004", "ARG001", "ARG005", "PT009", "PLC0415", "RUF001"]
"**/tests/**/*.py" = ["S101", "S106", "D100", "D101", "D102", "D103", "D107", "PLR2004", "ARG001", "ARG005", "PT009", "PLC0415", "RUF001"]
"scripts/**/*.py" = ["T20", "S602", "S603", "S607"]
# Workflow scripts are CLIs run by Actions: stdout is their interface (T20),
# they shell out to git/gh by name on a runner PATH (S60x), and they print the
# same status emoji the tests assert on (RUF001), and their only "magic"
# numbers are argv-length and semver-part counts (PLR2004).
".github/scripts/**/*.py" = ["T20", "S602", "S603", "S607", "RUF001", "PLR2004"]
# Same CLIs, in the directory the reusable workflows check out as
# GHCOMMON_SCRIPTS_DIR. Keep this list identical to the one above.
".github/workflows/scripts/**/*.py" = ["T20", "S602", "S603", "S607", "RUF001", "PLR2004"]
"**/migrations/**/*.py" = ["D100", "D103"]
[lint.isort]
# Google Python Style Guide import ordering
known-first-party = ["gcommon"]
known-third-party = ["fastapi", "pydantic", "starlette", "requests", "yaml"]
force-sort-within-sections = true
force-single-line = false
combine-as-imports = true
split-on-trailing-comma = true
[lint.pydocstyle]
convention = "google"
[lint.pylint]
max-args = 7
max-branches = 12
max-returns = 6
max-statements = 50
[lint.mccabe]
max-complexity = 15
[format]
# Use double quotes for strings
quote-style = "double"
# Use spaces around slice operators
docstring-code-format = true
docstring-code-line-length = 80