package main func init() { register(Check{ Seq: 70, ID: "7", Title: "No useState for tab state in routes (use URL ?tab= params)", Run: func(ctx *ScanContext, rep *Reporter) { if len(ctx.frontendTargets) > 0 { var tabViolations []tabStateViolation for _, target := range ctx.frontendTargets { for _, v := range checkTabState(target.dir) { v.file = prefixDisplayPath(target.label, v.file) tabViolations = append(tabViolations, v) } } if len(tabViolations) > 0 { rep.Fail("%d route file(s) use useState for tab state — use URL search params (?tab=)", len(tabViolations)) for _, v := range tabViolations { rep.Findingf("%s:%d %s", v.file, v.line, v.snippet) } } else { rep.OK("No useState tab state in routes") } } else { rep.Skip("no frontend sources found") } }, }) }