-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Runs code formatter on NaiveDateTime #6889
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
Conversation
raise ArgumentError, | ||
"cannot calculate the difference between #{inspect(naive_datetime1)} and #{ | ||
inspect(naive_datetime2) | ||
} because their calendars are not compatible and thus the result would be ambiguous" |
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.
this break feels a little strange to me, but the only way I could come up to avoid it was to concatenate multiple strings. any comments?
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.
Please do split the message into multiple strings and concatenate them with <>
. It's what we do all over the codebase 👍
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.
Done! Thank you for reviewing it!
minute: minute, | ||
second: second, | ||
microsecond: microsecond | ||
}) do |
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.
Would it be better to change this to the following?
def to_string(naive_datetime) do
%{calendar: calendar,
year: year,
month: month,
day: day,
hour: hour,
minute: minute,
second: second,
microsecond: microsecond} = naive_datetime
calendar.naive_datetime_to_string(year, month, day, hour, minute, second, microsecond)
end
If changed and a map/struct not matching this keys is passed to the function, it would change the expected error. I felt like keeping the keys there made more sense.
comments?
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.
Yes please keep the keys in order to leave the semantics intact. We can always revisit later if we want to do more "refactory" changes.
fcf2a39
to
d41034d
Compare
d41034d
to
30d2933
Compare
❤️ 💚 💙 💛 💜 |
Hopefully it is all good :)