Repository navigation
Expand file tree
/
Copy pathruff.toml
More file actions
111 lines (104 loc) · 5.51 KB
/
Copy pathruff.toml
File metadata and controls
111 lines (104 loc) · 5.51 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
# Ruff configuration for MagesticAI
# The Python this repo TARGETS (Factory#730). Absent, ruff inferred a version
# old enough to classify `tomllib` (stdlib since 3.11) as third-party, which
# is how this was found: security-lint/security_lint.py, vendored byte-exact
# from the hub and clean under standards/ruff.toml, reported I001 here. The
# bytes were identical; the verdict was not. Matched to standards/ruff.toml
# deliberately -- this is the fleet floor (coding-standards.md section 1,
# "Python (3.11+)"), not a strictness knob. AIFactory's root ruff.toml made
# the same fix first, for the same reason.
target-version = "py311"
# Vendored verification-core copies (Factory#158): these files are byte-exact
# mirrors of the Factory hub canonical (scripts/) and are governed by the
# byte-exact drift gate (verification-core-drift workflow), NOT this repo's style
# bar. Reformatting them under the local config (default line-length 88) would
# make them diverge from the hub canonical (formatted at line-length 100) and
# break the drift gate. Excluded from format/lint here for the same reason the
# Factory hub excludes its shared/factory-github vendored mirror.
extend-exclude = [
# Byte-exact mirror of the Factory hub canonical scripts/ratchet_helpers.py,
# kept identical by the verification-core drift gate. The hub formats at 100;
# letting the local formatter touch it would silently break byte-exactness
# and the next re-vendor (Factory#403).
"scripts/ratchet_helpers.py",
"apps/backend/agents/verification_gate.py",
"apps/backend/tools/runners/nix_provisioner.py",
# Its sibling: the declarative language-descriptor loader, vendored together
# with tools/runners/languages/*.yaml (the descriptors it globs). Same hub
# canonical (scripts/language_descriptors.py), same drift gate, same reason
# to keep the local formatter off it.
"apps/backend/tools/runners/language_descriptors.py",
"apps/backend/tools/runners/artifact_store.py",
"apps/backend/tools/runners/job_dispatch.py",
# Factory#638: the far half of job_dispatch.trace_env — the bootstrap the
# dispatched Job calls to join the run's trace and emit. Same canonical, same
# gate, same reason to keep the local 88-column formatter off it.
"apps/backend/tools/runners/job_tracing.py",
# Same deal for the factory-github provider layer: a byte-exact mirror of
# the hub's shared/factory-github/, policed by factory-github-drift.yml.
"apps/backend/runners/github/",
# And for factory_common: a byte-exact mirror of the hub's
# shared/factory-common/factory_common/ (the stdlib-only utility layer that
# carries sanitize_log). Same reason as above -- the hub formats at 100, the
# local formatter at 88, and reformatting here silently breaks byte-exactness
# against the pin in apps/web-server/factory_common/.hub-sha.
"apps/web-server/factory_common/",
]
[lint]
# Enable common rule sets
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long (handled by formatter)
"B008", # function call in default argument
"B904", # raise from err (too many to fix now)
"B905", # zip without strict parameter
"C401", # unnecessary generator
"C416", # unnecessary list comprehension
"E402", # module level import not at top of file
"F841", # local variable assigned but never used
"W293", # blank line contains whitespace
"B007", # loop control variable not used
"F821", # undefined name (forward refs in type hints used as strings)
"UP035", # deprecated typing imports (legacy modules use typing.List/Dict)
# 20 sites, newly visible now that target-version = py311 turns this rule
# on (Factory#730/#763). NOT auto-applied: `class X(str, Enum)` -> `class
# X(StrEnum)` is a BEHAVIOR change, not a style one -- str(member) returns
# the value itself under StrEnum, but "ClassName.MEMBER" under the str+Enum
# mixin, and several of the 20 (verdict/status enums) are serialized to
# JSON or logged. Ratchet backlog: convert per-class once each one's
# str()/repr call sites are checked, not as an unsafe-fix sweep.
"UP042", # replace str+Enum mixin with StrEnum
]
[lint.per-file-ignores]
"__init__.py" = ["F401"] # unused imports in __init__.py
"tests/*" = [
"B011", # assert false in tests
"B017", # assert raises bare Exception (acceptable in tests)
"E712", # == True/False (occasionally clearer in test assertions)
"E722", # bare except (acceptable in test cleanup)
"F401", # unused imports (availability checks)
"F811", # redefined-while-unused (pytest fixture argument shadowing)
]
"test_*.py" = ["F401", "F811"]
# The shared test carve-out from standards/ruff.toml (Factory#730). `extend`
# does not deep-merge per-file-ignores -- defining this table locally replaces
# the baseline's, so the carve-out is repeated verbatim here, the same
# technique PFactory's root ruff.toml already uses. Neither S nor PL is in
# this repo's `select` above, so this is a no-op today and stays that way
# until one of them is adopted -- at which point it is already correct instead
# of silently reopening a hole standards/ruff.toml closed.
"**/test_*.py" = ["S101", "PLR2004"]
"**/*_test.py" = ["S101", "PLR2004"]
"**/tests/**" = ["S101", "PLR2004"]
[format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"