diff --git a/CHANGELOG.md b/CHANGELOG.md index acdbf31..0971996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ ## master (unreleased) +## 0.35.0 (2024-03-10) + ### New features * [#301](https://github.com/rubocop/rubocop-minitest/issues/301): Add new Minitest/Focus cop. ([@jaredmoody][]) diff --git a/config/default.yml b/config/default.yml index fc52e4e..c66923e 100644 --- a/config/default.yml +++ b/config/default.yml @@ -150,7 +150,7 @@ Minitest/Focus: Description: 'Checks for focused tests.' Enabled: pending AutoCorrect: contextual - VersionAdded: '<>' + VersionAdded: '0.35' Minitest/GlobalExpectations: Description: 'This cop checks for deprecated global expectations.' diff --git a/docs/antora.yml b/docs/antora.yml index 02c3684..6a7af67 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -2,6 +2,6 @@ name: rubocop-minitest title: RuboCop Minitest # We always provide version without patch here (e.g. 1.1), # as patch versions should not appear in the docs. -version: ~ +version: '0.35' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops.adoc b/docs/modules/ROOT/pages/cops.adoc index 4f4e6eb..ed77161 100644 --- a/docs/modules/ROOT/pages/cops.adoc +++ b/docs/modules/ROOT/pages/cops.adoc @@ -36,6 +36,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide]. * xref:cops_minitest.adoc#minitestassertioninlifecyclehook[Minitest/AssertionInLifecycleHook] * xref:cops_minitest.adoc#minitestduplicatetestrun[Minitest/DuplicateTestRun] * xref:cops_minitest.adoc#minitestemptylinebeforeassertionmethods[Minitest/EmptyLineBeforeAssertionMethods] +* xref:cops_minitest.adoc#minitestfocus[Minitest/Focus] * xref:cops_minitest.adoc#minitestglobalexpectations[Minitest/GlobalExpectations] * xref:cops_minitest.adoc#minitestlifecyclehooksorder[Minitest/LifecycleHooksOrder] * xref:cops_minitest.adoc#minitestliteralasactualargument[Minitest/LiteralAsActualArgument] diff --git a/docs/modules/ROOT/pages/cops_minitest.adoc b/docs/modules/ROOT/pages/cops_minitest.adoc index b08218c..58e421f 100644 --- a/docs/modules/ROOT/pages/cops_minitest.adoc +++ b/docs/modules/ROOT/pages/cops_minitest.adoc @@ -13,7 +13,7 @@ | Enabled | Yes -| Yes +| Always | 0.2 | - |=== @@ -44,7 +44,7 @@ assert_empty(object, 'message') | Enabled | Yes -| Yes +| Always | 0.5 | 0.11 |=== @@ -71,7 +71,7 @@ assert_empty(object) | Enabled | Yes -| Yes +| Always | 0.4 | - |=== @@ -102,7 +102,7 @@ assert_equal("rubocop-minitest", actual) | Pending | Yes -| Yes +| Always | 0.10 | - |=== @@ -134,7 +134,7 @@ assert_in_delta(0.2, actual, 0.001, 'message') | Enabled | Yes -| Yes +| Always | 0.2 | - |=== @@ -166,7 +166,7 @@ assert_includes(collection, object, 'message') | Enabled | Yes -| Yes +| Always | 0.4 | - |=== @@ -202,7 +202,7 @@ assert_instance_of(Class, object, 'message') | Pending | Yes -| Yes +| Always | 0.10 | 0.34 |=== @@ -239,7 +239,7 @@ assert_kind_of(Class, object, 'message') | Enabled | Yes -| Yes +| Always | 0.6 | - |=== @@ -274,7 +274,7 @@ assert_match(matcher, string, 'message') | Enabled | Yes -| Yes +| Always | 0.1 | - |=== @@ -310,7 +310,7 @@ assert_nil(actual, 'message') | Pending | Yes -| Yes +| Always | 0.32 | - |=== @@ -371,7 +371,7 @@ assert_output(expected) { puts object.method } | Pending | Yes -| Yes +| Always | 0.10 | - |=== @@ -402,7 +402,7 @@ assert_path_exists(path, 'message') | Pending | Yes -| Yes +| Always | 0.18 | - |=== @@ -517,7 +517,7 @@ assert_match(/some message/, exception.message) | Enabled | Yes -| Yes +| Always | 0.3 | - |=== @@ -551,7 +551,7 @@ assert_respond_to(self, :do_something) | Pending | Yes -| Yes +| Always | 0.26 | - |=== @@ -585,7 +585,7 @@ assert_same(expected, actual) | Pending | Yes -| Yes +| Always | 0.10 | - |=== @@ -615,7 +615,7 @@ assert_silent { puts object.do_something } | Enabled | No -| Yes (Unsafe) +| Always (Unsafe) | 0.2 | 0.27 |=== @@ -800,7 +800,7 @@ end | Pending | Yes -| Yes +| Always | 0.23 | - |=== @@ -821,6 +821,38 @@ do_something assert_equal(expected, actual) ---- +== Minitest/Focus + +|=== +| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed + +| Pending +| Yes +| Command-line only +| 0.35 +| - +|=== + +Enforces tests are not focused. + +=== Examples + +[source,ruby] +---- +# bad +focus test 'foo' do +end + +# bad +focus +test 'foo' do +end + +# good +test 'foo' do +end +---- + == Minitest/GlobalExpectations |=== @@ -828,7 +860,7 @@ assert_equal(expected, actual) | Enabled | Yes -| Yes +| Always | 0.7 | 0.26 |=== @@ -959,7 +991,7 @@ value { musts }.must_raise TypeError | Pending | Yes -| Yes +| Always | 0.28 | - |=== @@ -1019,7 +1051,7 @@ end | Pending | Yes -| Yes +| Always | 0.10 | - |=== @@ -1276,7 +1308,7 @@ end | Pending | Yes -| Yes +| Always | 0.34 | - |=== @@ -1303,7 +1335,7 @@ assert_equal(expected, actual, 'message') | Enabled | Yes -| Yes +| Always | 0.3 | - |=== @@ -1334,7 +1366,7 @@ refute_empty(object, 'message') | Enabled | Yes -| Yes +| Always | 0.3 | - |=== @@ -1367,7 +1399,7 @@ refute_equal("rubocop-minitest", actual) | Enabled | No -| Yes (Unsafe) +| Always (Unsafe) | 0.3 | 0.27 |=== @@ -1412,7 +1444,7 @@ refute(actual, 'message') | Pending | Yes -| Yes +| Always | 0.10 | - |=== @@ -1444,7 +1476,7 @@ refute_in_delta(0.2, actual, 0.001, 'message') | Enabled | Yes -| Yes +| Always | 0.3 | - |=== @@ -1476,7 +1508,7 @@ refute_includes(collection, object, 'message') | Enabled | Yes -| Yes +| Always | 0.4 | - |=== @@ -1512,7 +1544,7 @@ refute_instance_of(Class, object, 'message') | Pending | Yes -| Yes +| Always | 0.10 | 0.34 |=== @@ -1549,7 +1581,7 @@ refute_kind_of(Class, object, 'message') | Enabled | Yes -| Yes +| Always | 0.6 | - |=== @@ -1585,7 +1617,7 @@ refute_match(matcher, string, 'message') | Enabled | Yes -| Yes +| Always | 0.2 | - |=== @@ -1621,7 +1653,7 @@ refute_nil(actual, 'message') | Pending | Yes -| Yes +| Always | 0.32 | - |=== @@ -1650,7 +1682,7 @@ refute_operator(expected, :<, actual) | Pending | Yes -| Yes +| Always | 0.10 | - |=== @@ -1681,7 +1713,7 @@ refute_path_exists(path, 'message') | Pending | Yes -| Yes +| Always | 0.18 | - |=== @@ -1713,7 +1745,7 @@ refute_predicate(obj, :one?, 'message') | Enabled | Yes -| Yes +| Always | 0.4 | - |=== @@ -1747,7 +1779,7 @@ refute_respond_to(self, :do_something) | Pending | Yes -| Yes +| Always | 0.26 | - |=== @@ -1781,7 +1813,7 @@ refute_same(expected, actual) | Pending | Yes -| Yes +| Always | 0.31 | - |=== @@ -1967,7 +1999,7 @@ test_my_class.rb | Pending | Yes -| Yes +| Always | 0.10 | - |=== diff --git a/lib/rubocop/minitest/version.rb b/lib/rubocop/minitest/version.rb index 26670cb..a2fd2b5 100644 --- a/lib/rubocop/minitest/version.rb +++ b/lib/rubocop/minitest/version.rb @@ -4,7 +4,7 @@ module RuboCop module Minitest # This module holds the RuboCop Minitest version information. module Version - STRING = '0.34.5' + STRING = '0.35.0' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/relnotes/v0.35.0.md b/relnotes/v0.35.0.md new file mode 100644 index 0000000..f9d40ff --- /dev/null +++ b/relnotes/v0.35.0.md @@ -0,0 +1,16 @@ +### New features + +* [#301](https://github.com/rubocop/rubocop-minitest/issues/301): Add new Minitest/Focus cop. ([@jaredmoody][]) + +### Bug fixes + +* [#300](https://github.com/rubocop/rubocop-minitest/pull/300): Fix an error for `Minitest/AssertEmptyLiteral` when only passing an empty literal. ([@earlopain][]) + +### Changes + +* [#303](https://github.com/rubocop/rubocop-minitest/pull/303): Require RuboCop 1.61 to use `AutoCorrect: Contextual`. ([@koic][]) +* [#304](https://github.com/rubocop/rubocop-minitest/pull/304): Require RuboCop AST >= 1.31.1 to support Prism as a Ruby Parser. ([@koic][]) + +[@jaredmoody]: https://github.com/jaredmoody +[@earlopain]: https://github.com/earlopain +[@koic]: https://github.com/koic