Skip to content
Permalink
Browse files

Mark ActiveRecord/Aliases as unsafe autocorrect

We faced an issue where our custom `update_attributes` method call was changed to `update` but the method name remained same in the method definition.

```ruby
def update_attributes
end

update_attributes
```

```ruby
def update_attributes
end

update
```

So the cop is not safe for auto correct.
  • Loading branch information...
prathamesh-sonpatki committed Jul 30, 2019
1 parent aedb97c commit 7c55d9b02714fb3c1f78ea185488420d042de152
Showing with 4 additions and 1 deletion.
  1. +2 −0 CHANGELOG.md
  2. +1 −0 config/default.yml
  3. +1 −1 manual/cops_rails.md
@@ -4,6 +4,7 @@

### New features

* [#98](https://github.com/rubocop-hq/rubocop-rails/pull/98): Mark `Rails/ActiveRecordAliases` as `SafeAutoCorrect` false and disable autocorrect by default. ([@prathamesh-sonpatki][])
* [#78](https://github.com/rubocop-hq/rubocop-rails/issues/78): Add new `Rails/EnumHash` cop. ([@fedeagripa][], [@brunvez][], [@santib][])

### Bug fixes
@@ -54,3 +55,4 @@
[@fedeagripa]: https://github.com/fedeagripa
[@brunvez]: https://github.com/brunvez
[@santib]: https://github.com/santib
[@prathamesh-sonpatki]: https://github.com/prathamesh-sonpatki
@@ -31,6 +31,7 @@ Rails/ActiveRecordAliases:
Use `update!` instead of `update_attributes!`.
Enabled: true
VersionAdded: '0.53'
SafeAutoCorrect: false

Rails/ActiveRecordOverride:
Description: >-
@@ -51,7 +51,7 @@ Include | `app/controllers/**/*.rb` | Array

Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
--- | --- | --- | --- | ---
Enabled | Yes | Yes | 0.53 | -
Enabled | Yes | Yes (Unsafe) | 0.53 | -

Checks that ActiveRecord aliases are not used. The direct method names
are more clear and easier to read.

0 comments on commit 7c55d9b

Please sign in to comment.
You can’t perform that action at this time.