check-safety/check_buildmodeplugin.go
Alex Dunmow c4d01de82c feat: concise output + diff-scoped any check
Reporter is now a collector: checks declare a verdict (OK/Skip/Warn/Fail/
Fatal) plus findings, and a single central render() prints output. Default
output is silent on pass/skip — only FAIL/WARN/ERR checks print, followed by
one tally line, so a clean run is two lines. --verbose restores full per-check
output. All ~30 checks were converted to this API; orphaned guidance/label
helpers (printPerTargetOKLines, per-check *Help blocks, colors_format.go) were
removed.

The any-usage check (2e) now defaults to only the unstaged working-tree diff
(changed lines), via a new per-repo git-diff index in changedlines.go; --all-any
restores the full scan. Not-a-git-repo / no-diff warns on nothing.

Golden fixtures regenerated; integration tests updated to the new format; added
unit tests for the diff index.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 01:16:56 +08:00

33 lines
1.1 KiB
Go

package main
// enableBuildmodePluginCheck is the per-check enable toggle. It ships DISABLED
// (WO-WZ-009): the wasm plugin migration is still porting the fleet off `.so`,
// so a `-buildmode=plugin` target is not yet a hard error. WO-WZ-017 flips this
// to true once every plugin repo builds wasm via `ninja plugin build`.
//
// While disabled the check prints NOTHING and never fails, so it neither
// disturbs golden snapshots nor blocks in-flight ports.
const enableBuildmodePluginCheck = false
func init() {
register(Check{
Seq: 290,
ID: "29",
Title: "No -buildmode=plugin targets in ported plugin repos",
Run: func(ctx *ScanContext, rep *Reporter) {
if !enableBuildmodePluginCheck {
return // disabled until WO-WZ-017; emit no output
}
violations := checkBuildmodePlugin(ctx.resolvedPluginTargets)
if len(violations) > 0 {
rep.Fail("%d legacy .so build target(s) found — build wasm with `ninja plugin build`", len(violations))
for _, v := range violations {
rep.Findingf("%s:%d %s", v.file, v.line, v.snippet)
}
} else {
rep.OK("No -buildmode=plugin targets found")
}
},
})
}