Skip to content

Commit

Permalink
Raise severity of some cops to warning
Browse files Browse the repository at this point in the history
The cops below belong to linting, not style preference,
so make set the severity to warning.

The following emulates warnings for deprecated APIs:

- Minitest/GlobalExpectations (#60)

The following suggests incorrect usage of APIs:

- Minitest/AssertRaisesWithRegexpArgument:
- Minitest/AssertWithExpectedArgument:
- Minitest/SkipEnsure:
- Minitest/UnreachableAssertion:
  • Loading branch information
koic committed Dec 17, 2022
1 parent 870dad0 commit 1061906
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/change_raise_severity_of_some_cops_to_warning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#204](https://github.com/rubocop/rubocop-minitest/pull/204): Raise severity of `Minitest/AssertRaisesWithRegexpArgument`, `Minitest/AssertWithExpectedArgument`, `Minitest/GlobalExpectations`, `Minitest/SkipEnsure`, and `Minitest/UnreachableAssertion` cops to warning. ([@koic][])
11 changes: 10 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ Minitest/AssertRaisesCompoundBody:
Minitest/AssertRaisesWithRegexpArgument:
Description: 'This cop enforces checks for regular expression literals passed to `assert_raises`.'
Enabled: pending
Severity: warning
VersionAdded: '0.22'
VersionChanged: '<<next>>'

Minitest/AssertRespondTo:
Description: 'This cop enforces the test to use `assert_respond_to(object, :do_something)` over `assert(object.respond_to?(:do_something))`.'
Expand All @@ -108,8 +110,10 @@ 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
Severity: warning
Safe: false
VersionAdded: '0.11'
VersionChanged: '<<next>>'

Minitest/AssertionInLifecycleHook:
Description: 'This cop checks for usage of assertions in lifecycle hooks.'
Expand All @@ -131,6 +135,7 @@ Minitest/GlobalExpectations:
Description: 'This cop checks for deprecated global expectations.'
StyleGuide: 'https://minitest.rubystyle.guide#global-expectations'
Enabled: true
Severity: warning
EnforcedStyle: any
Include:
- '**/test/**/*'
Expand All @@ -143,7 +148,7 @@ Minitest/GlobalExpectations:
- expect
- value
VersionAdded: '0.7'
VersionChanged: '0.16'
VersionChanged: '<<next>>'

Minitest/LiteralAsActualArgument:
Description: 'This cop enforces correct order of `expected` and `actual` arguments for `assert_equal`.'
Expand Down Expand Up @@ -237,7 +242,9 @@ Minitest/RefuteRespondTo:
Minitest/SkipEnsure:
Description: 'Checks that `ensure` call even if `skip`.'
Enabled: pending
Severity: warning
VersionAdded: '0.20'
VersionChanged: '<<next>>'

Minitest/TestMethodName:
Description: 'This cop enforces that test method names start with `test_` prefix.'
Expand All @@ -247,7 +254,9 @@ Minitest/TestMethodName:
Minitest/UnreachableAssertion:
Description: 'This cop checks for an `assert_raises` block containing any unreachable assertions.'
Enabled: pending
Severity: warning
VersionAdded: '0.14'
VersionChanged: '<<next>>'

Minitest/UnspecifiedException:
Description: 'This cop checks for a specified error in `assert_raises`.'
Expand Down

0 comments on commit 1061906

Please sign in to comment.