Skip to content

Commit

Permalink
gogrep: update gogrep code (from upstream) + rewrite tests (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
quasilyte authored Feb 1, 2021
1 parent 4f0d57f commit 0391c99
Show file tree
Hide file tree
Showing 4 changed files with 421 additions and 5 deletions.
4 changes: 3 additions & 1 deletion analyzer/testdata/src/extra/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ func testRules(m dsl.Matcher) {
m.Match(`if len($xs) != 0 { for range $xs { $*_ } }`,
`if len($xs) != 0 { for $i := range $xs { $*_ } }`,
`if len($xs) != 0 { for _, $x := range $xs { $*_ } }`,
`if len($xs) != 0 { for _, $x = range $xs { $*_ } }`,
`if $xs != nil { for range $xs { $*_ } }`,
`if $xs != nil { for $i := range $xs { $*_ } }`,
`if $xs != nil { for _, $x := range $xs { $*_ } }`).
`if $xs != nil { for _, $x := range $xs { $*_ } }`,
`if $xs != nil { for _, $x = range $xs { $*_ } }`).
Report(`check on $xs is redundant, empty/nil slices and maps can be safely iterated`)
}
Loading

0 comments on commit 0391c99

Please sign in to comment.