Skip to content

logs-logs-logs: describe Analyzer feedback #2939

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 18 additions & 0 deletions exercises/concept/logs-logs-logs/.meta/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,21 @@ This exercise's prerequisites Concepts are:
- `strings`
- `switch-statement`
- `constructors`

## Analyzer

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

1. Parse log level
- `LogLine.getLogLevel()`
- `actionable`: Verify that a switch statement was used. If they used if-else, comment that switch is better due to there being many cases.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting one - switch statements don't always appear in LogLine.getLogLevel. There are solutions that add a method to the LogLevel enum, like this one.

2. Support unknown log level
- `essential`: Verify that a default was used in a switch statement. Comment as previously stated in the case of an if-else.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A default isn't always needed, especially if a switch expression is used (switch expressions will force you to either list all values or have a default).

3. Convert log line to short format
- `essential`: Verify that there exists a field dedicated to the encoded log level.
- `actionable`: Said field should be private and final (this will then require the use of a getter for the log level!).
Comment on lines +34 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be sufficient to check that they have used a field and is final (no need to check if private and that there is a method to get the log level).

- `LogLine.getOutputForShortLog()`
- `informative`: Let them know they can write it in one return statement.
- `celebratory`: Celebrate if the student's solution brought up no comments.

[analyzer]: https://github.com/exercism/java-analyzer