package main func init() { register(Check{ Seq: 140, ID: "14", Title: "No raw SQL outside sqlc/Bob", Run: func(ctx *ScanContext, rep *Reporter) { var rawSQLViolations []rawSQLViolation for _, target := range ctx.backendTargets { for _, v := range checkRawSQL(target.root) { v.file = prefixDisplayPath(target.display, v.file) rawSQLViolations = append(rawSQLViolations, v) } } for _, target := range ctx.pluginTargets { for _, v := range checkRawSQL(target.root) { v.file = prefixDisplayPath(target.display, v.file) rawSQLViolations = append(rawSQLViolations, v) } } if len(rawSQLViolations) > 0 { rep.Fail("%d raw SQL statement(s) found outside sqlc/Bob", len(rawSQLViolations)) for _, v := range rawSQLViolations { rep.Findingf("%s:%d %s", v.file, v.line, v.snippet) } } else { rep.OK("No raw SQL outside sqlc/Bob") } }, }) }