Skip to content

Commit

Permalink
[Fix rubocop#126] Mark Minitest/AssertWithExpectedArgument as unsafe
Browse files Browse the repository at this point in the history
Fixes rubocop#126.

This PR marks `Minitest/AssertWithExpectedArgument` as unsafe.

This cop is marked as unsafe, because it is not possible to determine
whether the second argument of `assert` is a message or not.
  • Loading branch information
koic committed Mar 22, 2021
1 parent 0d47b7e commit 9167de4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Changes

* [#126](https://github.com/rubocop/rubocop-minitest/issues/126): Mark `Minitest/AssertWithExpectedArgument` as unsafe. ([@koic][])

## 0.11.0 (2021-03-22)

### New features
Expand Down
1 change: 1 addition & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Minitest/AssertTruthy:
Minitest/AssertWithExpectedArgument:
Description: 'This cop tries to detect when a user accidentally used `assert` when they meant to use `assert_equal`.'
Enabled: pending
Safe: false
VersionAdded: '0.11'

Minitest/GlobalExpectations:
Expand Down
3 changes: 3 additions & 0 deletions lib/rubocop/cop/minitest/assert_with_expected_argument.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module Minitest
# This cop tries to detect when a user accidentally used
# `assert` when they meant to use `assert_equal`.
#
# It is marked as unsafe because it is not possible to determine
# whether the second argument of `assert` is a message or not.
#
# @example
# # bad
# assert(3, my_list.length)
Expand Down

0 comments on commit 9167de4

Please sign in to comment.