Skip to content
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

Add analyzer feedback for Annalyns Infiltration #2700

Merged
merged 6 commits into from
Feb 2, 2024
Merged
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
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