Skip to content

Adding analyzer feedback for booking-up-for-beauty concept exercise #2753

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions exercises/concept/booking-up-for-beauty/.meta/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@

- `strings`: know how to use string formatting.
- `numbers`: know how to apply basic mathematical operators.

## Analyzer

This exercise could benefit from the following rules in the [analyzer]:

- `actionable`: If the student did not use `ofPattern` and `parse` methods in the `schedule` method, instruct the student to do so.
- `actionable`: If the student did not use `isBefore` or `compareTo` methods in the `hasPassed` method, instruct the student to do so.
- `actionable`: If the student did not use `getHour` in the `isAfternoonAppointment` method, instruct the student to do so.
- `actionable`: If the student did not use `ofPattern` and `DateTimeFormatter.format` methods in the `getDescription` method, instruct the student to do so.
- `actionable`: If the student did not use `getYear` in the `getAnniversaryDate` method, instruct the student to do so.
- `informative`: If the solution uses `String.format` in the `getDescription` method, inform the student that this cause a small performance penalty compared to string concatenation.

If the solution does not receive any of the above feedback, it must be exemplar.
Leave a `celebratory` comment to celebrate the success!

[analyzer]: https://github.com/exercism/java-analyzer
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

class AppointmentScheduler {

private static final LocalDate OPENING_DATE = LocalDate.of(2015, Month.SEPTEMBER, 15);

public LocalDateTime schedule(String appointmentDateDescription) {
var formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss", Locale.ENGLISH);
return LocalDateTime.parse(appointmentDateDescription, formatter);
Expand All @@ -27,6 +25,6 @@ public String getDescription(LocalDateTime appointmentDate) {
}

public LocalDate getAnniversaryDate() {
return OPENING_DATE.withYear(LocalDate.now().getYear());
return LocalDate.of(LocalDate.now().getYear(), Month.SEPTEMBER, 15);
}
}