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>
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package main
|
|
|
|
import "path/filepath"
|
|
|
|
func init() {
|
|
register(Check{
|
|
Seq: 200,
|
|
ID: "20",
|
|
Title: "Tailwind v4 configuration (PostCSS, CSS directives, @config)",
|
|
Run: func(ctx *ScanContext, rep *Reporter) {
|
|
if len(ctx.frontendTargets) > 0 {
|
|
var twViolations []tailwindViolation
|
|
for _, target := range ctx.frontendTargets {
|
|
if target.pluginRules {
|
|
continue // Plugin frontends don't have their own PostCSS/Tailwind setup
|
|
}
|
|
for _, v := range checkTailwindV4(target.dir) {
|
|
v.file = filepath.Clean(prefixDisplayPath(target.label, v.file))
|
|
twViolations = append(twViolations, v)
|
|
}
|
|
}
|
|
if len(twViolations) > 0 {
|
|
rep.Fail("%d Tailwind v4 configuration issue(s)", len(twViolations))
|
|
for _, v := range twViolations {
|
|
if v.line > 0 {
|
|
rep.Findingf("%s:%d [%s] %s", v.file, v.line, v.rule, v.snippet)
|
|
} else {
|
|
rep.Findingf("%s [%s] %s", v.file, v.rule, v.snippet)
|
|
}
|
|
}
|
|
} else {
|
|
rep.OK("Tailwind v4 configuration is correct")
|
|
}
|
|
} else {
|
|
rep.Skip("no frontend sources found")
|
|
}
|
|
},
|
|
})
|
|
}
|