Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkers: fix equalFold rules autofix templates #1178

Merged
merged 1 commit into from Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions checkers/rules/rules.go
Expand Up @@ -569,7 +569,7 @@ func equalFold(m dsl.Matcher) {
`strings.ToUpper($x) == strings.ToUpper($y)`,
`$x == strings.ToUpper($y)`).
Where(m["x"].Pure && m["y"].Pure && m["x"].Text != m["y"].Text).
Suggest(`strings.EqualFold($x, $y)]`).
Suggest(`strings.EqualFold($x, $y)`).
Report(`consider replacing with strings.EqualFold($x, $y)`)

// string != patterns
Expand All @@ -581,7 +581,7 @@ func equalFold(m dsl.Matcher) {
`strings.ToUpper($x) != strings.ToUpper($y)`,
`$x != strings.ToUpper($y)`).
Where(m["x"].Pure && m["y"].Pure && m["x"].Text != m["y"].Text).
Suggest(`!strings.EqualFold($x, $y)]`).
Suggest(`!strings.EqualFold($x, $y)`).
Report(`consider replacing with !strings.EqualFold($x, $y)`)

// bytes.Equal patterns
Expand All @@ -593,7 +593,7 @@ func equalFold(m dsl.Matcher) {
`bytes.Equal(bytes.ToUpper($x), bytes.ToUpper($y))`,
`bytes.Equal($x, bytes.ToUpper($y))`).
Where(m["x"].Pure && m["y"].Pure && m["x"].Text != m["y"].Text).
Suggest(`bytes.EqualFold($x, $y)]`).
Suggest(`bytes.EqualFold($x, $y)`).
Report(`consider replacing with bytes.EqualFold($x, $y)`)
}

Expand Down
6 changes: 3 additions & 3 deletions checkers/rulesdata/rulesdata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.