From 85f61463bc66c19e4ef2f4f747c46b4e1929fd99 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Mon, 26 Apr 2021 21:59:05 +0900 Subject: [PATCH] [Fix #379] Mark `Rails/DynamicFindBy` as unsafe Fixes #379. This PR marks `Rails/DynamicFindBy` as unsafe. --- CHANGELOG.md | 1 + config/default.yml | 3 ++- docs/modules/ROOT/pages/cops_rails.adoc | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e6546caf7..d90ce134f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,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][]) diff --git a/config/default.yml b/config/default.yml index 5572cf1f48..2b0fe90ee4 100644 --- a/config/default.yml +++ b/config/default.yml @@ -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 diff --git a/docs/modules/ROOT/pages/cops_rails.adoc b/docs/modules/ROOT/pages/cops_rails.adoc index f9fc7b11b9..75429617b3 100644 --- a/docs/modules/ROOT/pages/cops_rails.adoc +++ b/docs/modules/ROOT/pages/cops_rails.adoc @@ -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.