-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Implement a cop that checks for something.length == 0 #2620
Comments
Is |
It's not the same in terms of semantics. |
Really? What's the difference? (I ask because I've been using |
|
Interesting. I am probably guilty of using |
Another difference.
|
The same check should probably also be done for the logically equivalent:
This might seem weird to some, but the habit is carried over by some from languages where this has benefit. |
Yeah, we should check this this as well. |
I implemented this cop as an exercise, and soon realized that What is the official strategy for dealing with such user implemented "duds"? I can see three possible paths, none of which seem ideal to me:
Please enlighten me. 😃 |
This is the answer. :-) |
Added in #2683. I guess this issue can be closed now. |
We should suggest replacing such checks with
empty?
.This cop should also handle
!=
and the common aliassize
.The text was updated successfully, but these errors were encountered: