Skip to content

Commit

Permalink
Mark Rails/UniqBeforePluck cop as unsafe auto-correction
Browse files Browse the repository at this point in the history
Follow rubocop/rubocop#8529 and rubocop#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
  • Loading branch information
koic committed Aug 17, 2020
1 parent c22496c commit 7ec4efd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion config/default.yml
Expand Up @@ -664,7 +664,7 @@ Rails/UniqBeforePluck:
SupportedStyles:
- conservative
- aggressive
Safe: false
SafeAutoCorrect: false
AutoCorrect: false

Rails/UniqueValidationWithoutIndex:
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/cops_rails.adoc
Expand Up @@ -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
Expand Down

0 comments on commit 7ec4efd

Please sign in to comment.