Design decisions

35. Taste lints (§8 tooling, 2026-11-21)

  1. The plan/PORTING.md taste checklist is machine-checked as lints L0501–L0506 (search_loop, discarded_result, symmetric_write, loop_reduction, index_only_loop, repeated_literal), read off the syntax tree like the other lints. Reason: ports passed every gate and still read like translated C++; a lint names the construct at the place. Reverse: drop rules/taste.rs and the six Lints.
  2. A fix-it only for the exact shape, and never when it could change meaning: not when the loop holds a ? (it would leave the comprehension, not the fn), when the file declares a fn of the reduction's name, when the accumulator starts from a non-number (sum of strings), or for max/min (empty has no value). The rewrite keeps the declaration's type and edits only its initializer. Applying every fix to the corpus changes 136 files and breaks none that checked before. Reverse: widen the shapes in exact_search and reduce.
  3. repeated_literal counts lines, not occurrences (-1e9..=1e9 is one fact), and fires for a value of at least 1e6 on two lines or at least 1000 on three. Reason: bounds and moduli are big; small numbers repeat honestly. Reverse: change the thresholds in repeated_literals.
  4. Two friction detectors become lints: push_after_literal as L0507 push_loop (with a fix to a comprehension, head + [..] after a non-empty start) and none_check_unwrap as L0508 (no fix: the right rewrite, if let or comparing the option, depends on the use). They are taste lints too: the checklist's hand-rolled structures and sentinels. Reverse: drop them from LINTS.
  5. repeated_literal skips the types of let x: T = read(): equal statement bounds of different inputs are separate facts. The first 30-hit sample had 6 false positives, all such bounds; after the change a second sample of 30 had 1 (a loop with side effects read as a search). Reverse: drop input_types in repeated_literals.
  6. cpl lint --taste reports only L05xx, a line per file and a total; the scoreboard counts it per port apart from lint_warnings, so a taste finding is a review signal and never fails the gate. Reverse: fold taste into lint_warnings in scripts/scoreboard.py.
  7. The friction detector negative_slice gets no lint: a[..-k] is already the check error E0309 with the same fix, so the friction script's one wa_trap is stale. Reverse: none needed.