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

Document snippet extension #410

Merged
merged 2 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Document snippet extension
  • Loading branch information
ErikSchierboom committed Nov 15, 2022
commit 1c8ba89221a495b0c36cf37e36b233bd158cce1d
3 changes: 2 additions & 1 deletion building/configlet/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,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