Skip to content

Commit

Permalink
Add analyzer feedback for Annalyns Infiltration (#2700)
Browse files Browse the repository at this point in the history
* Add analyzer feedback for Annalyns Infiltration

* Update analyzer according to comments

* Make if statement comment essential

* Remove trailing space

* Fix formatting

* Fix formatting
  • Loading branch information
kahgoh authored Feb 2, 2024
1 parent d7c37fc commit de59086
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions exercises/concept/annalyns-infiltration/.meta/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,30 @@ Nothing to report
## Prerequisites

- `basics`: know how to define methods.

## Analyzer

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

- `essential`: If student returns a boolean literal, tell them it is possible to directly return the result of a expression. For example:

```java
// instead of
if (knightIsAwake) {
return true;
} else {
return false;
}

// ... return the expression directly
return knightIsAwake;
```

- `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`).
- `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.
- `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 `||`.

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

0 comments on commit de59086

Please sign in to comment.