@@ -107,6 +107,18 @@ ignore = [
107107 " N802" , " N803" , " N806" ,
108108 # Lazy imports of heavy deps (torch/onnx/modal) are deliberate
109109 " PLC0415" , # import-outside-top-level
110+ # Wide keyword-only signatures are how this codebase does configuration:
111+ # the compile entry points and ops library take many knobs by design,
112+ # and much of that surface is called by torchwright_doom (2026-07 survey:
113+ # 122 sites, tail to 26 args, all classified honest or public API)
114+ " PLR0913" , # too-many-arguments
115+ # "token" in this codebase means vocabulary token (bos_token/eos_token/
116+ # unk_token, format-version tags), never a credential
117+ " S105" , " S106" , " S107" ,
118+ # Advisory subprocess rules with no satisfying code change: the Modal
119+ # launchers and git-provenance helpers build argv lists, never shell=True
120+ " S603" , # subprocess-without-shell-equals-true
121+ " S607" , # start-process-with-partial-path
110122]
111123
112124[tool .ruff .lint .pydocstyle ]
@@ -117,7 +129,61 @@ convention = "google"
117129 " PLR2004" , # magic values allowed in tests
118130 " ANN" , # type annotations optional in tests
119131 " SLF001" , # private-member access allowed in tests
132+ " E402" , # pytest.importorskip must precede the imports it guards
133+ " ARG001" , # pytest fixtures/hooks are resolved by parameter name
120134]
135+ # Complexity leaves (2026-07 wave-2 review): functions where helper
136+ # extraction would move code across the I1-I4 assertion points, plus
137+ # if/elif dispatch tables where splitting only relocates the table.
138+ "torchwright/compiler/forward/add_placement.py" = [" C901" ]
139+ "torchwright/compiler/forward/compile.py" = [" C901" , " PLR0912" , " PLR0915" ]
140+ "torchwright/compiler/forward/cpsat_scheduler.py" = [
141+ " C901" , " PLR0912" , " PLR0915" ,
142+ " SLF001" , # documented cache injection into Node._live_weight_row_ranges
143+ ]
144+ "torchwright/compiler/forward/residual_map.py" = [
145+ " C901" , # _check_invariants IS the I1 assertion body
146+ " ARG002" , # free/hold's `mech` is a documented subclass interface slot
147+ ]
148+ "torchwright/compiler/forward/scheduler.py" = [" C901" , " PLR0912" , " PLR0915" ]
149+ "torchwright/compiler/forward/weight_writer.py" = [" C901" , " PLR0912" , " PLR0915" ]
150+ "torchwright/graph/affine_rules.py" = [
151+ " C901" , # compute_affine_bound is a node-type dispatch table
152+ " SLF001" , # refresh_node_caches is the designated cache-write choke point
153+ ]
154+ "scripts/measure_op_noise.py" = [" PLR0915" ] # render_markdown doc-table pipeline
155+ "tests/compile/forward/test_cpsat_intralayer.py" = [" C901" ] # mirrors production warm-start loop
156+ "tests/compile/test_graph_clone.py" = [
157+ " C901" , # per-field comparator dispatch table
158+ " BLE001" , # generic field comparator's deliberate fallback
159+ ]
160+ # Interface slots and recorded design decisions
161+ "torchwright/compiler/export.py" = [
162+ " ARG002" , # empty_past's max_len: call-site symmetry with ONNX runtime
163+ " ANN401" , # **attrs at ONNX make_node emission is genuinely dynamic
164+ ]
165+ "torchwright/compiler/forward/cpsat_snapshot.py" = [
166+ " BLE001" , # _git_commit is best-effort provenance by contract
167+ " ANN401" , # SchedulingProblem._replace passthrough
168+ ]
169+ "torchwright/compiler/hf/build.py" = [" PTH100" ] # abspath: symlink semantics differ from resolve()
170+ "torchwright/compiler/hf/modeling_torchwright_custom.py" = [" ARG002" ] # HF forward() interface kwargs
171+ "torchwright/compiler/hf/tokenization_torchwright_custom.py" = [" FBT001" , " FBT002" ] # transformers override signature
172+ "torchwright/compiler/realization.py" = [" SLF001" ] # live_weight_row_ranges owns its memo cache
173+ "torchwright/compiler/transformer.py" = [" ARG002" ] # past_len: accepted-and-ignored interface slot
174+ "torchwright/debug/probe.py" = [" ANN401" ] # past_kvs differs structurally per backend
175+ "torchwright/graph/misc.py" = [" ARG002" ] # Node.compute keyword contract on constant nodes
176+ "torchwright/graph/node.py" = [" PLW0603" ] # module-level node-id counter, reset by tests
177+ # Op names deliberately mirror the builtins they implement for graph nodes
178+ "torchwright/ops/relu/arithmetic_ops.py" = [" A001" ]
179+ "torchwright/ops/swiglu/arithmetic_ops.py" = [" A001" ]
180+ "torchwright/ops/swiglu/__init__.py" = [" A004" ]
181+ "tests/hf/test_calculator_parity.py" = [" S307" ] # eval() of arithmetic expressions is the oracle
182+ "scripts/arithmetic_scaling.py" = [
183+ " SLF001" , # recorded reach-in: scratchpad private ops for the viz panel
184+ " FBT003" , # matplotlib ax.grid(True)
185+ ]
186+ "scripts/calculator_layer_table.py" = [" BLE001" ] # records any build refusal as a data row
121187
122188[tool .ruff .format ]
123189docstring-code-format = true
0 commit comments