-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
[Fix #133] Add new Minitest/UnreachableAssertion
cop
#137
Merged
koic
merged 1 commit into
rubocop:master
from
koic:add_new_minitest_assertion_in_assert_raises_cop
Jun 26, 2021
Merged
[Fix #133] Add new Minitest/UnreachableAssertion
cop
#137
koic
merged 1 commit into
rubocop:master
from
koic:add_new_minitest_assertion_in_assert_raises_cop
Jun 26, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
koic
force-pushed
the
add_new_minitest_assertion_in_assert_raises_cop
branch
3 times, most recently
from
June 23, 2021 08:31
a3f0387
to
b2bd8c6
Compare
andyw8
reviewed
Jun 23, 2021
koic
force-pushed
the
add_new_minitest_assertion_in_assert_raises_cop
branch
2 times, most recently
from
June 24, 2021 01:54
c14cb6e
to
ce6d72e
Compare
andyw8
reviewed
Jun 24, 2021
koic
force-pushed
the
add_new_minitest_assertion_in_assert_raises_cop
branch
from
June 24, 2021 02:46
ce6d72e
to
2c6446e
Compare
andyw8
reviewed
Jun 24, 2021
Fixes rubocop#133. This PR adds new `Minitest/UnreachableAssertion` cop. This cop checks for `assert_raises` has an assertion method at the bottom of block because the assertion will be never reached. ```ruby # bad assert_raises FooError do obj.occur_error assert_equal('foo', obj.bar) # Never reached. end # good assert_raises FooError do obj.occur_error end assert_equal('foo', obj.bar) ```
koic
force-pushed
the
add_new_minitest_assertion_in_assert_raises_cop
branch
from
June 24, 2021 03:13
2c6446e
to
73d2969
Compare
andyw8
approved these changes
Jun 24, 2021
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.
👍
koic
added a commit
to koic/rails
that referenced
this pull request
Aug 17, 2021
I found an unexpected use of assertion in the block of `assert_raise` when I implemented rubocop/rubocop-minitest#137. It is expected to be asserted after an exception is raised in `assert_raise` block, but in actually it is not asserted after an exception is raised. Therefore, this PR removes or updates assertions that have not been asserted after an exception has raised. This PR will add `rubocop-minitest` and enable `Minitest/UnreachableAssertion` cop to able similar auto-detection, but will remove `rubocop-minitest` from this PR if you don't like it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #133.
This PR adds new
Minitest/UnreachableAssertion
cop.This cop checks for
assert_raises
has an assertion method at the bottom of block because the assertion will be never reached.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.