package main func init() { register(Check{ Seq: 160, ID: "16", Title: "Services and handlers in correct directories", Run: func(ctx *ScanContext, rep *Reporter) { var structViolations []structureViolation for _, target := range ctx.backendTargets { for _, v := range checkServiceStructure(target.root) { v.file = prefixDisplayPath(target.display, v.file) structViolations = append(structViolations, v) } } for _, target := range ctx.pluginTargets { for _, v := range checkServiceStructure(target.root) { v.file = prefixDisplayPath(target.display, v.file) structViolations = append(structViolations, v) } } if len(structViolations) > 0 { rep.Fail("%d type(s) in wrong directory", len(structViolations)) for _, v := range structViolations { rep.Findingf("%s:%d [%s] %s", v.file, v.line, v.rule, v.snippet) } } else { rep.OK("All services and handlers in correct directories") } }, }) }