Skip to content

Commit

Permalink
Merge pull request rubocop#465 from koic/mark_rails_dynamic_find_by_a…
Browse files Browse the repository at this point in the history
…s_unsafe

[Fix rubocop#379] Mark `Rails/DynamicFindBy` as unsafe
  • Loading branch information
koic authored Apr 26, 2021
2 parents 8151200 + 85f6146 commit 7db0947
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* [#444](https://github.com/rubocop/rubocop-rails/issues/444): Mark `Rails/Blank` as unsafe auto-correction. ([@koic][])
* [#451](https://github.com/rubocop/rubocop-rails/issues/451): Make `Rails/RelativeDateConstant` aware of `yesterday` and `tomorrow` methods. ([@koic][])
* [#454](https://github.com/rubocop/rubocop-rails/pull/454): Mark `Rails/WhereExists` as unsafe auto-correction. ([@koic][])
* [#379](https://github.com/rubocop/rubocop-rails/issues/379): Mark `Rails/DynamicFindBy` as unsafe. ([@koic][])
* [#456](https://github.com/rubocop/rubocop-rails/pull/456): Drop Ruby 2.4 support. ([@koic][])
* [#462](https://github.com/rubocop/rubocop-rails/pull/462): Require RuboCop 1.7 or higher. ([@koic][])

Expand Down
3 changes: 2 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ Rails/DynamicFindBy:
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
StyleGuide: 'https://rails.rubystyle.guide#find_by'
Enabled: true
Safe: false
VersionAdded: '0.44'
VersionChanged: '2.6'
VersionChanged: '2.10'
# The `Whitelist` has been deprecated, Please use `AllowedMethods` instead.
Whitelist:
- find_by_sql
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/cops_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1103,10 +1103,10 @@ delegate :foo, to: :bar, allow_nil: true
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Enabled
| Yes
| Yes
| No
| Yes (Unsafe)
| 0.44
| 2.6
| 2.10
|===

This cop checks dynamic `find_by_*` methods.
Expand Down

0 comments on commit 7db0947

Please sign in to comment.