-
-
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
Include a Cop to enforce assert_nil over assert_equal(nil) #6
Conversation
4441ed3
to
2d84040
Compare
Awesome work! It ’s a great first step. We can hack in the future based on the code base. 👍 |
Can you add the setting of this cop to config/default.yml? The following is an example and let's set |
73ffdab
to
cf2f301
Compare
hey @koic 👋 I did update the code with the suggested changes. I changed the node_matcher pattern to capture the argument: https://github.com/rubocop-hq/rubocop-minitest/pull/6/files#diff-4e8bec16638093f13a99617349303b4bR18 can you check if it is valid? thanks so much! ☕️ |
The assert_equal(nil, actual, 'message') |
8e5349d
to
e4aed88
Compare
hey @koic 👋 I updated the code. WDYT with the changes ? thanks ☕️ |
e4aed88
to
2b24cc0
Compare
a602299
to
7e0f733
Compare
hey @koic, I did apply your changes, can you review? thanks so much |
@duduribeiro I see all tests are failing due to passing the wrong number of arguments to one method. |
4ec0910
to
5e6d9fc
Compare
5e6d9fc
to
280a17a
Compare
@koic I updated the code |
280a17a
to
1f00a1a
Compare
hey @koic 👋 I changed the node pattern to allow message to be a variable and a constant and also allowing the method call. Can you check please? thanks so much ☕️ |
1f00a1a
to
2c9dc41
Compare
2c9dc41
to
526f32d
Compare
@koic I changed with your suggestions. Thanks so much |
This commit adds a Cop that checks some usage of `assert_equal(nil, something)` and enforces the usage of `assert_nil(something)` instead.
526f32d
to
599a146
Compare
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.
Many thanks for your great work!
@koic thanks for your help! |
@bbatsov I'd like to release RuboCop Minitest 0.1.0 after merging this PR and maintaining some documentation. This cop is the first cop that will be published on RuboCop Minitest. |
@koic I completely agree. Let's make this happen. 😄 |
Hey folks 👋
This commit adds a Cop that checks some usage of
assert_equal(nil, something)
and enforces the usage ofassert_nil(something)
instead.I don't know if the cop that I wrote is right and maybe it needs some adjustment 😂
I also needed to copy some code from the rubocop gem itself, because the matchers itself relies on
RSpec
. Maybe we can change it in rubocop gem to share part of the code that can be reusable, and add the matchers for rspec and minitest.