-
Notifications
You must be signed in to change notification settings - Fork 0
I've improved the KDocs and inline comments in DateTimeDiffer
and `…
#413
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
base: main
Are you sure you want to change the base?
Conversation
…DateTimeDifferTest`. This will enhance the documentation and comments in `DateTimeDiffer.kt` and its corresponding test file `DateTimeDifferTest.kt`. Here are the key changes: - **`DateTimeDiffer.kt`**: - I updated the KDocs for `diffWorkingHours` and `workingDuration` to include explicit `@param`, `@return`, and `@throws` tags. - I restructured KDoc descriptions for better clarity on function behavior, assumptions, and handling of edge cases (e.g., times outside working hours, weekends). - I removed commented-out debugging code. - I converted a "Future Note" to a `TODO` comment. - I improved inline comments to explain the "why" behind complex logic, not just the "what". - I replaced informal comments with professional explanations. - **`DateTimeDifferTest.kt`**: - I reviewed and confirmed the accuracy of the main class KDoc. - I removed an overly verbose multi-line comment block, replacing it with a concise explanation. - I corrected a misleading comment in one of the test cases. - I ensured test method names are descriptive and inline comments are helpful and accurate. These changes aim to make your code easier to understand, maintain, and use.
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.
Pull Request Overview
This PR enhances documentation and inline comments in DateTimeDiffer
and its tests for clarity and maintainability.
- Refactored KDoc in
DateTimeDiffer.kt
: added explicit tags, restructured descriptions, removed debug code, and added a TODO. - Cleaned up verbose comments in
DateTimeDifferTest.kt
: replaced with concise, scenario-based inline comments. - Improved inline explanations to focus on the “why” of complex logic, not just the “what.”
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/main/kotlin/dev/hossain/time/DateTimeDiffer.kt | Enhanced KDoc, removed debugging blocks, added TODO, clarified logic with inline comments. |
src/test/kotlin/dev/hossain/time/DateTimeDifferTest.kt | Simplified comments, added realistic test scenario notes, removed large commented-out sections. |
Comments suppressed due to low confidence (2)
src/test/kotlin/dev/hossain/time/DateTimeDifferTest.kt:130
- [nitpick] The test name uses
diff
instead of the method under test,diffWorkingHours
. Rename the test to start withdiffWorkingHours - given…
to maintain consistency with other tests.
fun `diff - given start time is before working hour and end time during work hour - provides diff of working hour only`() {
src/main/kotlin/dev/hossain/time/DateTimeDiffer.kt:109
- This assignment overrides the
previousWorkingDay
calculated just above fromnextWorkingDayAfterWeekend
, potentially skipping the intended start time. Consider reusingnextWorkingDayAfterWeekend
directly rather than chaining off the originalpreviousWorkingDay
.
previousWorkingDay = previousWorkingDay.nextWorkingDay().prevWorkingHour()
* | ||
* @param startInstant The start instant of the period. | ||
* @param endInstant The end instant of the period. | ||
* @param timeZoneId The ZoneId to determine local working days and hours. |
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.
The KDoc parameter name timeZoneId
does not match the function signature which uses zoneId
. Update the @param
to zoneId
for accuracy.
Copilot uses AI. Check for mistakes.
* ↑ ↑ | ||
* Start End | ||
* of Day of Day | ||
* ↑ ↑ ↑ |
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.
[nitpick] The ASCII art arrows and labels for week start, week end, and weekend are misaligned and can be confusing. Consider simplifying or realigning this diagram for clarity, or removing it if it adds more complexity than benefit.
Copilot uses AI. Check for mistakes.
Has some good inline comments for different cases. Salvage them later. |
…DateTimeDifferTest`.
This will enhance the documentation and comments in
DateTimeDiffer.kt
and its corresponding test fileDateTimeDifferTest.kt
.Here are the key changes:
DateTimeDiffer.kt
:diffWorkingHours
andworkingDuration
to include explicit@param
,@return
, and@throws
tags.TODO
comment.DateTimeDifferTest.kt
:These changes aim to make your code easier to understand, maintain, and use.