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/TimeZone as unsafe auto-correction from unsafe #576

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#576](https://github.com/rubocop/rubocop-rails/pull/576): Mark `Rails/TimeZone` as unsafe auto-correction from unsafe. ([@koic][])
4 changes: 2 additions & 2 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,9 @@ Rails/TimeZone:
StyleGuide: 'https://rails.rubystyle.guide#time'
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
Enabled: true
Copy link
Member

Choose a reason for hiding this comment

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

On an afterthought, we are effectively enabling the cop that was otherwise disabled for those running rubocop with --safe option. But I believe it is fine, since the default is to run all cops (as far as I understand).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this would be an acceptable change :-)

Safe: false
SafeAutoCorrect: false
VersionAdded: '0.30'
VersionChanged: '2.10'
VersionChanged: '2.13'
# The value `strict` means that `Time` should be used with `zone`.
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
EnforcedStyle: flexible
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/cops_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4600,10 +4600,10 @@ SQL
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Enabled
| No
| Yes
| Yes (Unsafe)
| 0.30
| 2.10
| 2.13
|===

This cop checks for the use of Time methods without zone.
Expand Down