You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: exercises/concept/annalyns-infiltration/.meta/design.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,3 +17,30 @@ Nothing to report
17
17
## Prerequisites
18
18
19
19
-`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
+
returntrue;
31
+
} else {
32
+
returnfalse;
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!
0 commit comments