Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark Rails/ApplicationController and similar cops as unsafe autocorrect #223

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you mark VersionChanged: '2.5'?

Suggested change
VersionAdded: '2.4'
VersionAdded: '2.4'
VersionChanged: '2.5'

Same for other changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, updated && rebased && force-pushed a1aa7d5

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