Skip to content

Commit de59086

Browse files
authored
Add analyzer feedback for Annalyns Infiltration (#2700)
* Add analyzer feedback for Annalyns Infiltration * Update analyzer according to comments * Make if statement comment essential * Remove trailing space * Fix formatting * Fix formatting
1 parent d7c37fc commit de59086

File tree

1 file changed

+27
-0
lines changed
  • exercises/concept/annalyns-infiltration/.meta

1 file changed

+27
-0
lines changed

exercises/concept/annalyns-infiltration/.meta/design.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,30 @@ Nothing to report
1717
## Prerequisites
1818

1919
- `basics`: know how to define methods.
20+
21+
## Analyzer
22+
23+
This exercise could benefit from the following rules in the [analyzer]:
24+
25+
- `essential`: If student returns a boolean literal, tell them it is possible to directly return the result of a expression. For example:
26+
27+
```java
28+
// instead of
29+
if (knightIsAwake) {
30+
return true;
31+
} else {
32+
return false;
33+
}
34+
35+
// ... return the expression directly
36+
return knightIsAwake;
37+
```
38+
39+
- `essential`: If the student compares a boolean variable with a boolean literal (e.g. `knightIsAwake == true` or `archerIsAwake == false`), tell them this can be simplified to just the variables (e.g. `knightIsAwake` or `archerIsAwake`).
40+
- `essential`: If the student uses an `if` statement or the ternary operator, tell them this exercise was to explore booleans and boolean operators and this exercise can be solved without them.
41+
- `informative`: If the student uses an `||` expression to OR two smaller expressions and either expression is surrounded by parentheses and only ANDs some terms together (e.g. `knightIsAwake || (archerIsAwake && !prisonerIsAwake)`), tell them the parentheses is unnecessary because `&&` has the higher precedence over `||`.
42+
43+
If the solution does not receive any of the above feedback, it must be exemplar.
44+
Leave a `celebratory` comment to celebrate the success!
45+
46+
[analyzer]: https://github.com/exercism/java-analyzer

0 commit comments

Comments
 (0)