From 7ec4efd4ac28f1d951e9db7d3098ed2f20de2489 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 18 Aug 2020 08:17:29 +0900 Subject: [PATCH] Mark `Rails/UniqBeforePluck` cop as unsafe auto-correction Follow https://github.com/rubocop-hq/rubocop/pull/8529 and #320. This PR changes the mark of `Rails/UniqBeforePluck` from `Safe: false` to `SafeAutoCorrect: false`. False positives to detection are not a concern. Only worry about incompatibilities with auto-correction. Below is an excerpt from the official document. > * Safe (true/false) - indicates whether the cop can yield false > positives (by design) or not. > > *SafeAutoCorrect (true/false) - indicates whether the auto-correct a cop > does is safe (equivalent) by design. If a cop is unsafe its auto-correct > automatically becomes unsafe as well. https://docs.rubocop.org/rubocop/0.89/usage/auto_correct.html#safe-auto-correct --- CHANGELOG.md | 2 +- config/default.yml | 2 +- docs/modules/ROOT/pages/cops_rails.adoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd429d4ce..0266e2a66d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ * [#312](https://github.com/rubocop-hq/rubocop-rails/pull/312): Mark `Rails/MailerName` as unsafe for auto-correct. ([@eugeneius][]) * [#294](https://github.com/rubocop-hq/rubocop-rails/pull/294): Update `Rails/ReversibleMigration` to register offenses for `remove_columns` and `remove_index`. ([@philcoggins][]) * [#310](https://github.com/rubocop-hq/rubocop-rails/issues/310): Add `EnforcedStyle` to `Rails/PluckInWhere`. By default, it does not register an offense if `pluck` method's receiver is a variable. ([@koic][]) -* [#320](https://github.com/rubocop-hq/rubocop-rails/pull/320): Mark `Rails/UniqBeforePluck` as unsafe. ([@kunitoo][]) +* [#320](https://github.com/rubocop-hq/rubocop-rails/pull/320): Mark `Rails/UniqBeforePluck` as unsafe auto-correction. ([@kunitoo][]) * [#324](https://github.com/rubocop-hq/rubocop-rails/pull/324): Make `Rails/IndexBy` and `Rails/IndexWith` aware of `to_h` with block. ([@eugeneius][]) ## 2.7.1 (2020-07-26) diff --git a/config/default.yml b/config/default.yml index 171b5824ba..8b39352ba2 100644 --- a/config/default.yml +++ b/config/default.yml @@ -664,7 +664,7 @@ Rails/UniqBeforePluck: SupportedStyles: - conservative - aggressive - Safe: false + SafeAutoCorrect: false AutoCorrect: false Rails/UniqueValidationWithoutIndex: diff --git a/docs/modules/ROOT/pages/cops_rails.adoc b/docs/modules/ROOT/pages/cops_rails.adoc index a42ee1c1fe..dad912b742 100644 --- a/docs/modules/ROOT/pages/cops_rails.adoc +++ b/docs/modules/ROOT/pages/cops_rails.adoc @@ -3979,7 +3979,7 @@ Time.at(timestamp).in_time_zone | Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Enabled -| No +| Yes | Yes (Unsafe) | 0.40 | 2.8