Skip to content

Commit

Permalink
Document snippet extension (exercism#410)
Browse files Browse the repository at this point in the history
Document snippet extension
  • Loading branch information
ErikSchierboom authored Nov 16, 2022
1 parent 24881b8 commit 43a2d22
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion building/configlet/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ The `config.json` file should have the following checks:
- The `"files.example` and `"files.exemplar"` files _can_ overlap
- The `"test_runner.average_run_time"` key is required if `"status.test_runner"` is equal to `true`
- The `"test_runner.average_run_time"` value must be a floating-point number > 0 with one decimal point of precision
- The `"approaches.snippet_extension"` key is required if the track has one or more approaches
- The `"approaches.snippet_extension"` value must be a non-blank string¹
- The `"exercises"` key is required
- The `"exercises.concept"` key is required
- The `"exercises.concept"` value must be an array
Expand Down Expand Up @@ -375,10 +377,11 @@ The `config.json` file should have the following checks:
- The Markdown must conform to the [Markdown standards](/docs/building/markdown/markdown)
- Links must be absolute (relative links are not allowed)

### Rule: exercises/{concept|practice}/<slug>/.approaches/<approach-slug>/snippet.txt is valid
### Rule: exercises/{concept|practice}/<slug>/.approaches/<approach-slug>/snippet.<snippet-extension> is valid

- The file's presence is required if a matching `"approaches[].slug"` entry exists in the `.approaches/config.json` file
- The snippet must have at most 8 lines
- The snippet extension is taken from the `approaches.snippet_extension` value in the track's `config.json` file

### Rule: exercises/{concept|practice}/<slug>/.articles/config.json is valid

Expand Down
4 changes: 4 additions & 0 deletions building/tracks/approaches.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ If you'd like to compare different approaches, please write an [articles](/docs/
In general, [Practice Exercises](/docs/building/tracks/practice-exercises) are more suitable to write approaches for, as they usually can be solved in multiple ways.

For [Concept Exercises](/docs/building/tracks/concept-exercises), discussing the exemplar approach might be interesting. For example, you could show how the concept being taught makes certain code easier to write.

## Configuring

Make sure to set the `approaches.snippet_extension` field in your [track's `config.json` file](/docs/building/tracks/config-json).
5 changes: 5 additions & 0 deletions building/tracks/config-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ The following top-level properties contain general track metadata:
- `editor`: additional read-only editor file(s) patterns (optional)
- `test_runner`: an object describing the track's test runner (if any): (required if `status.test_runner` is `true`)
- `average_run_time`: a `number` value for the number of seconds the test runner takes on average to run, rounded to one decimal point precision (e.g. `1.8`) (required if `status.test_runner` is `true`)
- `approaches`: an object with metadata on the track's approaches: (required if the track has any approaches)
- `snippet_extension`: a string value used for the snippet file's extension (e.g. `rb`) (required if the track has any approaches)

### Files

Expand Down Expand Up @@ -70,6 +72,9 @@ Support will be added to [configlet](/docs/building/configlet) to use these patt
},
"test_runner": {
"average_run_time": 2.3
},
"approaches": {
"snippet_extension": "cs"
}
}
```
Expand Down

0 comments on commit 43a2d22

Please sign in to comment.