-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add cop to enfore refute_empty over refute(actual.empty?) #20
Conversation
1e2fefd
to
870b213
Compare
870b213
to
5efaffd
Compare
RUBY | ||
end | ||
|
||
def test_registers_offense_when_using_refute_with_empty_and_variable_message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't tests with variable/constant message redundant? The way I see it you only check for the argument count in the cop itself, so this is bound to work whatever you pass to it.
module RuboCop | ||
module Cop | ||
module Minitest | ||
# Check if your test uses `refute_empty` instead of `refute(actual.empty?)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to write this the other way around.
5efaffd
to
e906b85
Compare
@bbatsov : Resolved the comments on this PR too. Please have a look. |
module Cop | ||
module Minitest | ||
# This cop enforces to use `refute_empty` instead of | ||
# using `refute(actual.empty?)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actual -> object
RUBY | ||
end | ||
|
||
def test_registers_offense_when_using_refute_with_empty_and_string_message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess "string message" can be shortened to just "message".
e906b85
to
9518f36
Compare
9518f36
to
43488d1
Compare
@bbatsov : Rebased and resolved the comments. Please have a look. Thanks |
Looks good. Thanks! |
PR adds cops to enforce the use of refute_empty over refute(actual.empty?)
Ref: https://github.com/rubocop-hq/minitest-style-guide#refute-empty