Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EnforcedStyle: refute to Rails/RefuteMethods #150

Closed
grosser opened this issue Nov 3, 2019 · 2 comments · Fixed by #182
Closed

Add EnforcedStyle: refute to Rails/RefuteMethods #150

grosser opened this issue Nov 3, 2019 · 2 comments · Fixed by #182
Labels
enhancement New feature or request

Comments

@grosser
Copy link
Contributor

grosser commented Nov 3, 2019

Our project prefer to use refute instead of assert_not ... so having an EnforcedStyle to define that would be nice.

@koic koic added the enhancement New feature or request label Nov 4, 2019
koic added a commit to koic/rubocop-rails that referenced this issue Dec 31, 2019
Fixes rubocop#150.

This PR adds `EnforcedStyle: refute` for `Rails/RefuteMethods`.

`EnforcedStyle: refute` is an alternative style to
`EnforcedStyle: assert_not`.

```ruby
# @example EnforcedStyle: refute
#   # bad
#   assert_not false
#   assert_not_empty [1, 2, 3]
#   assert_not_equal true, false
#
#   # good
#   refute false
#   refute_empty [1, 2, 3]
#   refute_equal true, false
```

The default style keeps `EnforcedStyle: assert_not` because
following the Rails coding style.

> Use `assert_not` methods instead of refute.

https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
koic added a commit to koic/rubocop-rails that referenced this issue Dec 31, 2019
Fixes rubocop#150.

This PR adds `EnforcedStyle: refute` for `Rails/RefuteMethods`.

`EnforcedStyle: refute` is an alternative style to
`EnforcedStyle: assert_not`.

```ruby
# @example EnforcedStyle: refute
#   # bad
#   assert_not false
#   assert_not_empty [1, 2, 3]
#   assert_not_equal true, false
#
#   # good
#   refute false
#   refute_empty [1, 2, 3]
#   refute_equal true, false
```

The default style keeps `EnforcedStyle: assert_not` because
following the Rails coding conventions conventions.

> Use `assert_not` methods instead of refute.

https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
@andyw8
Copy link
Contributor

andyw8 commented Dec 31, 2019

Just wondering, would this be more suited to rubocop-minitest than rubocop-rails? (I'm not sure how closely Rails is integrated with minitest).

@koic
Copy link
Member

koic commented Dec 31, 2019

RuboCop Minitest is a linter for pure Minitest. The assert_not methods has been extended by Active Support.
https://github.com/rails/rails/blob/v6.0.2.1/activesupport/lib/active_support/test_case.rb#L147-L159

So I think RuboCop Rails is suitable.

koic added a commit to koic/rubocop-rails that referenced this issue Jan 12, 2020
Fixes rubocop#150.

This PR adds `EnforcedStyle: refute` for `Rails/RefuteMethods`.

`EnforcedStyle: refute` is an alternative style to
`EnforcedStyle: assert_not`.

```ruby
# @example EnforcedStyle: refute
#   # bad
#   assert_not false
#   assert_not_empty [1, 2, 3]
#   assert_not_equal true, false
#
#   # good
#   refute false
#   refute_empty [1, 2, 3]
#   refute_equal true, false
```

The default style keeps `EnforcedStyle: assert_not` because
following the Rails coding conventions conventions.

> Use `assert_not` methods instead of refute.

https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
koic added a commit to koic/rubocop-rails that referenced this issue Feb 3, 2020
Fixes rubocop#150.

This PR adds `EnforcedStyle: refute` for `Rails/RefuteMethods`.

`EnforcedStyle: refute` is an alternative style to
`EnforcedStyle: assert_not`.

```ruby
# @example EnforcedStyle: refute
#   # bad
#   assert_not false
#   assert_not_empty [1, 2, 3]
#   assert_not_equal true, false
#
#   # good
#   refute false
#   refute_empty [1, 2, 3]
#   refute_equal true, false
```

The default style keeps `EnforcedStyle: assert_not` because
following the Rails coding conventions conventions.

> Use `assert_not` methods instead of refute.

https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
koic added a commit to koic/rubocop-rails that referenced this issue Feb 20, 2020
Fixes rubocop#150.

This PR adds `EnforcedStyle: refute` for `Rails/RefuteMethods`.

`EnforcedStyle: refute` is an alternative style to
`EnforcedStyle: assert_not`.

```ruby
# @example EnforcedStyle: refute
#   # bad
#   assert_not false
#   assert_not_empty [1, 2, 3]
#   assert_not_equal true, false
#
#   # good
#   refute false
#   refute_empty [1, 2, 3]
#   refute_equal true, false
```

The default style keeps `EnforcedStyle: assert_not` because
following the Rails coding conventions conventions.

> Use `assert_not` methods instead of refute.

https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
koic added a commit to koic/rubocop-rails that referenced this issue Mar 6, 2020
Fixes rubocop#150.

This PR adds `EnforcedStyle: refute` for `Rails/RefuteMethods`.

`EnforcedStyle: refute` is an alternative style to
`EnforcedStyle: assert_not`.

```ruby
# @example EnforcedStyle: refute
#   # bad
#   assert_not false
#   assert_not_empty [1, 2, 3]
#   assert_not_equal true, false
#
#   # good
#   refute false
#   refute_empty [1, 2, 3]
#   refute_equal true, false
```

The default style keeps `EnforcedStyle: assert_not` because
following the Rails coding conventions conventions.

> Use `assert_not` methods instead of refute.

https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
@koic koic closed this as completed in #182 Mar 18, 2020
koic added a commit that referenced this issue Mar 18, 2020
…s_refute_methods

[Fix #150] Add `EnforcedStyle: refute` for `Rails/RefuteMethods`
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants