-
Notifications
You must be signed in to change notification settings - Fork 39
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
Introduce additional matchers to TimeZoneUsage
rule
#311
Conversation
TimeZoneUsage
ruleTimeZoneUsage
rule
Suggested commit message:
|
c6f49e3
to
22918b9
Compare
I think it looks good in principle, but I worry about the migration effort that this will put on the WMS team, which will hurt adoption. What is the expected migration path for them, and can we help ease their pain? (They are big users of |
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.
Added a commit with some unrelated cleanup. Nice improvements @chamil-prabodha !
Created an alternative suggested commit message:
Have `TimeZoneUsage` check flag `{OffsetDate,Offset,ZonedDate}Time#now` (#311)
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.
Changes LGTM.
W.r.t. OffsetDateTime.now(clock)
usages: Internally we use UTC clocks, so I think that would become clock.instant().atOffset(UTC)
, which isn't that bad.
Add matchers for `OffsetDateTime`, `OffsetTime` and `ZonedDateTime` classes.
ea4fce0
to
827b70c
Compare
The
OffsetDateTime
,OffsetTime
andZonedDateTime
classes implement methods such asnow()
,now(Clock clock)
,now(ZoneId zone)
which either rely on the system clock or retrieve the time zone in the clock variable. The calls to the aforementioned methods should be avoided as per the definition ofTimeZoneUsage
rule.This PR detects the usage of such violations and produces warnings during the compilation.