-
-
Notifications
You must be signed in to change notification settings - Fork 710
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
f7f6ba2
2a80bc9
008572d
ff76098
1a96c52
44db848
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -20,3 +20,27 @@ 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 | ||||
- `LogLevel` | ||||
- `essential`: Verify that necessary and sufficient constants are present in enum declaration (minus unknown, for now) and that the constructor is present. | ||||
- `actionable`: The enum should be public; prompt the student to think of encapsulation. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think there is any point in the analyzer checking if the enum is
Suggested change
|
||||
- `LogLine.getLogLevel()` | ||||
- `essential`: Verify that a switch statement was used. If they used if-else, comment that switch is better due to there being many cases. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok with suggesting switch statements or switch expressions, but I think should be |
||||
- `actionable`: The function should be public. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think there is any point in the analyzer checking this. The method is
Suggested change
|
||||
2. Support unknown log level | ||||
- `essential`: Verify that an unknown constant is present in the enum declaration. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The analyzer doesn't need to check for this because it is covered by the tests.
Suggested change
|
||||
- `essential`: Verify that a default was used in a switch statement. Comment as previously stated in the case of an if-else. | ||||
3. Convert log line to short format | ||||
- `essential`: Verify that the constructor is appropriately updated. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which constructor is this referring to? Do you mean check there is a |
||||
- `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!). | ||||
- `LogLine.getOutputForShortLog()` | ||||
- `celebratory`: Celebrate if this was written in one line. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The celebratory comment should apply if no comments are raised (not that something was written on one line). See captain's log design.md for example. |
||||
- `informative`: Let them know they can write it in one line. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what's the thinking on this one. I'm not sure if the the analyzer can specifically enforce that something is written on just one line. For example, what if someone writes the following? return logLevel.getTypeLog()
+ ":"
+ logMessage; The formatting may split over multiple lines and I think that can be fine. Rather than checking if it is one line, what else can the analyzer check for as a sign that it isn't "one line"? |
||||
|
||||
[analyzer]: https://github.com/exercism/java-analyzer |
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 analyzer doesn't need to check for this because it is covered by the tests.