diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f2aa08..3b07ae4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/config/default.yml b/config/default.yml index 9ce0b4e6..e5677874 100644 --- a/config/default.yml +++ b/config/default.yml @@ -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: diff --git a/docs/modules/ROOT/pages/cops_minitest.adoc b/docs/modules/ROOT/pages/cops_minitest.adoc index e1f8f1d8..130bd62f 100644 --- a/docs/modules/ROOT/pages/cops_minitest.adoc +++ b/docs/modules/ROOT/pages/cops_minitest.adoc @@ -447,7 +447,7 @@ assert(actual, 'message') | Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Pending -| Yes +| No | No | 0.11 | - @@ -456,6 +456,9 @@ assert(actual, 'message') 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. + === Examples [source,ruby] diff --git a/lib/rubocop/cop/minitest/assert_with_expected_argument.rb b/lib/rubocop/cop/minitest/assert_with_expected_argument.rb index 938b447a..ec5ae247 100644 --- a/lib/rubocop/cop/minitest/assert_with_expected_argument.rb +++ b/lib/rubocop/cop/minitest/assert_with_expected_argument.rb @@ -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)