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: add new checker stringsCompare #1195

Merged
merged 12 commits into from Feb 5, 2022

Conversation

peakle
Copy link
Contributor

@peakle peakle commented Jan 16, 2022

pr for: #1167

checkers/rules/rules.go Outdated Show resolved Hide resolved
checkers/rules/rules.go Outdated Show resolved Hide resolved
checkers/rules/rules.go Outdated Show resolved Hide resolved
@quasilyte
Copy link
Member

I would do this in 2 steps:

  1. suggest simpler operations for the cases where the replacement is obvious.
  2. Implement other cases as a hand-written analyzer, to avoid false positives.

@quasilyte
Copy link
Member

@cristaloleg, what do you think?

checkers/rules/rules.go Outdated Show resolved Hide resolved
Copy link
Member

@quasilyte quasilyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, cover all cases with tests.
I don't see -1 value case.
Whether possible, all corner cases should be tested.

It's also a good practice to have "fixed" code examples in the negative tests suite.
For example, if linter suggests > operator, negative tests suite should contain the suggested code snippet, to be sure that this replacements does not trigger any other warning.

@quasilyte
Copy link
Member

LGTM.
@cristaloleg wanna make a final review? :)

@quasilyte quasilyte removed the request for review from cristaloleg February 5, 2022 07:57
@quasilyte quasilyte merged commit fc5746a into go-critic:master Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants