Do not suggest #name= for #name and vice versa #180
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A recent discussion on Hacker News reminded me of a particular type of suggestion that seems always irrelevant and potentially confusing. That would be suggesting
#foo
when someone callsobj.foo = 1
or#foo=
when someone callsobj.foo
. I have actually seen inexperienced Rubyists read the message, scratch their heads, and tryobj.foo(1)
before moving on to their next idea.Example:
This is a fairly brute force implementation -- if the missing method name ends with =, only suggest methods that do, and vice versa. A more nuanced approach would be just to exclude the exact method name with = added or removed, as the case may be. I'm happy to spend some more time on it if the general proposal is welcome.