Pre-commit -Werror does not cover unused imports #425
Labels
No labels
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#425
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
.git-hooks/pre-commit:36runsand reports "warnings as errors". The label is narrower than it sounds.
-Werrorpromotes only warnings the compiler emits, and Scala 3 keeps the whole
-Wunusedfamily off by default. Nothing in it has ever been reported: unusedimports, locals, privates, params, implicits.
The gate has therefore never covered unused code, and the count has drifted.
Measured against
mainon 2026-08-20:One of the 33 is
core/adapters/SessionHooks.scala:7(
import iw.core.output.Output), which is also a layering breach:core/CLAUDE.md:29allowsadapters/to importmodel/only. The unused-importgap and that breach are the same finding seen twice, and one cleanup closes both.
Found while working IW-422; recorded in that issue's
LESSONS.md. Pre-existing,unrelated to the herdr backend, and deliberately left out of IW-422's scope
because it touches 19 files and would swamp that diff.
Scope
.git-hooks/pre-commit.Both halves must land together: the flag alone blocks every commit.
Notes for whoever takes it
scala-cli compileexited0whileprinting
[error] unused importlines. Confirm the hook rejects a realviolation before trusting it — otherwise this issue adds a flag that reports
and does not block.
-Wunused:importsvs-Wunused:allwas not measured.allalso coverslocals, privates, params and implicits; the count will be larger and some of it
will be genuine (unused params in interface implementations). Measure both,
then choose. Do not widen without looking.
dashboard/needs the same treatment. Onlycore/wasmeasured — the hook compiles only
core/.Acceptance
verified against a deliberate violation.
core/compiles clean under the widened flag.core/adapters/SessionHooks.scalano longer importsiw.core.output.