-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
New cop to check for the use of Time.zone=
method.
#458
Comments
Setting |
olivierbuffon
added a commit
to olivierbuffon/rubocop-rails
that referenced
this issue
Apr 8, 2021
This cop checks for the use of Time.zone= method. Built on top of this nice Thoughtbot article (https://thoughtbot.com/blog/its-about-time-zones)
olivierbuffon
added a commit
to olivierbuffon/rubocop-rails
that referenced
this issue
Apr 8, 2021
This cop checks for the use of Time.zone= method. Built on top of this nice Thoughtbot article (https://thoughtbot.com/blog/its-about-time-zones)
@andyw8 Thanks for your feedback. |
olivierbuffon
added a commit
to olivierbuffon/rubocop-rails
that referenced
this issue
Apr 8, 2021
This cop checks for the use of Time.zone= method. Built on top of this nice Thoughtbot article (https://thoughtbot.com/blog/its-about-time-zones)
9 tasks
olivierbuffon
added a commit
to olivierbuffon/rubocop-rails
that referenced
this issue
Apr 9, 2021
This cop checks for the use of `Time.zone=` method. Built on top of this nice Thoughtbot article (https://thoughtbot.com/blog/its-about-time-zones)
olivierbuffon
added a commit
to olivierbuffon/rubocop-rails
that referenced
this issue
Apr 9, 2021
This cop checks for the use of `Time.zone=` method. Built on top of this nice Thoughtbot article (https://thoughtbot.com/blog/its-about-time-zones)
olivierbuffon
added a commit
to olivierbuffon/rubocop-rails
that referenced
this issue
Apr 11, 2021
This cop checks for the use of `Time.zone=` method. Built on top of this nice Thoughtbot article (https://thoughtbot.com/blog/its-about-time-zones)
koic
added a commit
that referenced
this issue
Apr 12, 2021
[Fix #458] Add new `Rails/TimeZoneAssignment` cop
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Jun 7, 2021
Fixes rubocop#495 This PR adds new `Rails/I18nLocaleAssignment` cop. It has a similar purpose to `Rails/TimeZoneAssignment` cop. rubocop#458
9 tasks
koic
added a commit
to koic/rubocop-rails
that referenced
this issue
Jun 8, 2021
Fixes rubocop#495 This PR adds new `Rails/I18nLocaleAssignment` cop. It has a similar purpose to `Rails/TimeZoneAssignment` cop. rubocop#458
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
I've been through a code base lately that use to use
Time.zone=
to temporarily update the application time zone for a specific operation.This might cause unexpected behaviors if the time zone is not set back to its original value.
Most of the time I've seen this pattern used in specs like:
Describe the solution you'd like
In order to avoid some issues related to the application time zone update, I would recommend the usage of
Time.use_zone(time_zone, &block)
instead. So we could be sure the time zone always reverts back to its initial value.Its also really simple to use in specs using the
around
hook:What do you think?
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: