You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
…uteOperator` cops
Fixesrubocop#255.
This PR adds new `Minitest/AssertOperator` and `Minitest/RefuteOperator` cops.
## `Minitest/AssertOperator` cop
This cop enforces the use of `assert_operator(expected, :<, actual)` over `assert(expected < actual)`.
```ruby
# bad
assert(expected < actual)
# good
assert_operator(expected, :<, actual)
```
## `Minitest/RefuteOperator` cop
This cop enforces the use of `refute_operator(expected, :<, actual)` over `refute(expected < actual)`.
```ruby
# bad
refute(expected < actual)
# good
refute_operator(expected, :<, actual)
```
Is your feature request related to a problem? Please describe.
When reviewing PRs of teammates using for example
assert(a < b)
Describe the solution you'd like
I'd like rubocop to recommend for example
assert_operator(a, :<, b)
Additional context
I was surprised I couldn't find this cop, as it seems pretty simple to implement (possibly naively) and it's in the minitest style guide https://github.com/rubocop/minitest-style-guide#assert-operator
Would you accept a PR for a new cop
Minitest/AssertOperator
?Thanks
The text was updated successfully, but these errors were encountered: