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

[Fix #150] Add EnforcedStyle: refute for Rails/RefuteMethods #182

Merged

Conversation

koic
Copy link
Member

@koic koic commented Dec 31, 2019

Fixes #150.

This PR adds EnforcedStyle: refute for Rails/RefuteMethods.

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

# @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 conventions..

Use assert_not methods instead of refute.

https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@koic koic force-pushed the add_supported_style_refute_for_rails_refute_methods branch from 4a3f407 to 406b8d1 Compare January 12, 2020 01:57
@koic koic force-pushed the add_supported_style_refute_for_rails_refute_methods branch from 406b8d1 to d70a776 Compare February 3, 2020 04:57
@koic koic force-pushed the add_supported_style_refute_for_rails_refute_methods branch from d70a776 to 1abf72b Compare February 20, 2020 00:40
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 force-pushed the add_supported_style_refute_for_rails_refute_methods branch from 1abf72b to 8ce0fcd Compare March 6, 2020 03:30
@koic koic merged commit efd16c2 into rubocop:master Mar 18, 2020
@koic koic deleted the add_supported_style_refute_for_rails_refute_methods branch March 18, 2020 05:55
@grosser
Copy link
Contributor

grosser commented Mar 18, 2020

awesome, thx! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add EnforcedStyle: refute to Rails/RefuteMethods
2 participants