Skip to content

Conversation

peakle
Copy link
Contributor

@peakle peakle commented Jan 16, 2022

pr for: #1167

@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 quasilyte requested a review from cristaloleg January 16, 2022 19:44
@quasilyte
Copy link
Member

@cristaloleg, what do you think?

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.

2 participants