Skip to content

Commit

Permalink
Merge pull request #223 from hoshinotsuyoshi/application-controller-u…
Browse files Browse the repository at this point in the history
…nsafe

Mark `Rails/ApplicationController` and similar cops as unsafe autocorrect
  • Loading branch information
koic authored Apr 1, 2020
2 parents ad4e97d + a1aa7d5 commit 32791a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
* [#214](https://github.com/rubocop-hq/rubocop-rails/issues/214): Fix an error for `Rails/UniqueValidationWithoutIndex`when a table has no column definition. ([@koic][])
* [#221](https://github.com/rubocop-hq/rubocop-rails/issues/221): Make `Rails/UniqueValidationWithoutIndex` aware of `add_index` in db/schema.rb. ([@koic][])

### Changes

* [#223](https://github.com/rubocop-hq/rubocop-rails/pull/223): Mark `Rails/ApplicationController`, `Rails/ApplicationJob`, `Rails/ApplicationMailer`, and `Rails/ApplicationRecord` as unsafe autocorrect. ([@hoshinotsuyoshi][])

## 2.5.0 (2020-03-24)

### New features
Expand Down Expand Up @@ -157,3 +161,4 @@
[@joshpencheon]: https://github.com/joshpencheon
[@djudd]: https://github.com/djudd
[@sunny]: https://github.com/sunny
[@hoshinotsuyoshi]: https://github.com/hoshinotsuyoshi
8 changes: 8 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,30 @@ Rails/ActiveSupportAliases:
Rails/ApplicationController:
Description: 'Check that controllers subclass ApplicationController.'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '2.4'
VersionChanged: '2.5'

Rails/ApplicationJob:
Description: 'Check that jobs subclass ApplicationJob.'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.49'
VersionChanged: '2.5'

Rails/ApplicationMailer:
Description: 'Check that mailers subclass ApplicationMailer.'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '2.4'
VersionChanged: '2.5'

Rails/ApplicationRecord:
Description: 'Check that models subclass ApplicationRecord.'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.49'
VersionChanged: '2.5'

Rails/AssertNot:
Description: 'Use `assert_not` instead of `assert !`.'
Expand Down
8 changes: 4 additions & 4 deletions manual/cops_rails.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ are not used.

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

This cop checks that controllers subclass ApplicationController.

Expand All @@ -153,7 +153,7 @@ end

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

This cop checks that jobs subclass ApplicationJob with Rails 5.0.

Expand All @@ -175,7 +175,7 @@ end

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

This cop checks that mailers subclass ApplicationMailer with Rails 5.0.

Expand All @@ -197,7 +197,7 @@ end

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

This cop checks that models subclass ApplicationRecord with Rails 5.0.

Expand Down

0 comments on commit 32791a6

Please sign in to comment.