analyzeWithRule parses sql and runs a single Rule against the first statement.
(t *testing.T, sql string, rule Rule)
| 24 | |
| 25 | // analyzeWithRule parses sql and runs a single Rule against the first statement. |
| 26 | func analyzeWithRule(t *testing.T, sql string, rule Rule) []Suggestion { |
| 27 | t.Helper() |
| 28 | tree, err := gosqlx.Parse(sql) |
| 29 | if err != nil { |
| 30 | t.Fatalf("Parse(%q): %v", sql, err) |
| 31 | } |
| 32 | if len(tree.Statements) == 0 { |
| 33 | t.Fatal("no statements parsed") |
| 34 | } |
| 35 | return rule.Analyze(tree.Statements[0]) |
| 36 | } |
| 37 | |
| 38 | // --------------------------------------------------------------------------- |
| 39 | // OPT-009: Correlated Subquery in SELECT List |
no test coverage detected