-
Notifications
You must be signed in to change notification settings - Fork 153
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
Convert zoneId String in RepoConfiguration and SummaryJson to ZoneId object #1674
Comments
Hi, I would like to ask if it is ok for me to work on this issue? |
Sure. |
I've edited the recommended approach. It is best to make the |
Ok thank you 😄 |
Should I keep the setters to allow public void setZoneId(ZoneId zoneId) {
this.zoneId = zoneId;
}
public void setZoneId(String zoneIdString) {
this.zoneId = ZoneId.of(zoneIdString);
} If not, then in some of the test cases there will be config.setZoneId(ZoneId.of("UTC-0530")); which is a bit longer than the original config.setZoneId("UTC-0530"); |
zoneId is stored as ZoneId object in CliArguments.java. It is converted into String when stored in RepoConfiguration.java. Subsequently, it is then converted back to ZoneId when required in FileInfoAnalyzer.java or other places. Such repeated conversion is redundant. Let's standardize and save zoneId as ZoneId Object across all files.
zoneId is stored as ZoneId object in CliArguments.java. It is converted into String when stored in RepoConfiguration.java. Subsequently, it is then converted back to ZoneId when required in FileInfoAnalyzer.java or other places. Such repeated conversion is redundant. Let's standardize and save zoneId as ZoneId Object across all files.
What feature(s) would you like to see in RepoSense?
I noticed that although
zoneId
is stored as aZoneId
object inCliArguments.java
, it is then converted to aString
when stored inRepoConfiguration.java
, subsequently, whenzoneId
needs to be used in places likeFileInfoAnalyzer.java
, it has to do the conversion back toZoneId
.Is the feature request related to a problem?
This conversion from
ZoneId
toString
toZoneId
is redundant. In my opinion, it is also quite strange to havezoneId
be aString
, when the variables thatzoneId
is commonly used with,sinceDate
anduntilDate
, areLocalDateTime
objects.If possible, describe the solution
Since
SummaryJson
objects for repos are written into Json files during tests, changingzoneId
to beZoneId
instead ofString
may cause the Json output to be different from expected Json files, potentially breaking the tests.zoneId
variable as aString
inSummaryJson
.String
toZoneId
inSummaryJson
should be attempted and tested first before reverting back if tests are broken.zoneId
variable is used in the code.zoneId
variable fromString
toZoneId
inRepoConfiguration.java
and propagate the change to any classes and methods (inclusive of test code) that break after this change.SummaryJson.java
.Additional context
This should be a good first-timer issue for future contributors such as CP3108A/B students. The tracing of the
zoneId
variable and the subsequent refactoring should provide enough exposure to the backend code.The text was updated successfully, but these errors were encountered: