Replace Time.zone.now with Time.current #2636
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trello: https://trello.com/c/wSKG73MP
Arises from: #2599
rubocop-govuk enables the "strict" style of the Rails/TimeZone cop[1]. This cop doesn't have a preference[2] for either of the equivalent methods
Time.zone.now
orTime.current
. Since the latter is shorter and we're currently using a mixture of both I've gone withTime.current
. I don't think we can enforce this without deviating from rubocop-govuk but hopefully being consistent now will help keep things that way.[1]
https://github.com/alphagov/rubocop-govuk/blob/97fcbc866aa10a75c7c1c89fc3c2c562cc04fc26/config/rails.yml#L89 [2] https://github.com/rubocop/rubocop-rails/blob/cb01e4d6a33b0e4285b2972f9c64fc45e5776429/lib/rubocop/cop/rails/time_zone.rb#L26