-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix offense message from Rails/TimeZone. #1777
Conversation
Please, remove the |
c3621a1
to
5ba02d7
Compare
I fix it and rebase on master. |
Rails/TimeZone rule generate offense message like 'Use #Time.zone.new instead'. But `Time.zone.new` is not exist. We should use `Time.zone.local`.
5ba02d7
to
aa70f41
Compare
Btw, Time.zone.local would be the equivalent only in case there are any arguments. Otherwise the equivalent would be |
Suggest Time.zone.now when Time.new is called without any argument.
Oh, I miss it. I add a commit to suggest
|
|
||
add_offense(node, :selector, | ||
format(MSG, | ||
"#{klass}.#{method_name}", | ||
"#Time.zone.#{method_name}") | ||
"#Time.zone.#{safe_method_name}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should not be #
before Time
and the code snippets should surrounded in backticks, so they're properly coloured in the terminal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix offense message from Rails/TimeZone.
👍 Thanks! |
Thanks! |
Now, Rubocop generate "Use #Time.zone.[:new] instead." for following code.
But
Time.zone.new
does not exist. We should useTime.zone.local
.As requested in the contributing guidelines: