Skip to content

Commit a7cb826

Browse files
CONTRIBUTING: formatting and linting (#581)
1 parent 46566f9 commit a7cb826

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,52 @@ Exercises can be tested against the test runner using
2626
bin/verify-exercises-in-docker
2727
```
2828

29+
## Formatting and linting
30+
31+
CI runs the following checks on every pull request, so please run them locally before submitting.
32+
33+
All Zig code — exercise stubs, example solutions and test files — must be formatted with `zig fmt`:
34+
35+
```bash
36+
zig fmt --check .
37+
```
38+
39+
The remaining checks use [configlet], Exercism's track maintenance tool.
40+
Fetch it once before running any `bin/configlet` command — this downloads the binary to `bin/configlet`:
41+
42+
```sh
43+
bin/fetch-configlet
44+
```
45+
46+
Or for Windows:
47+
48+
```sh
49+
bin/fetch-configlet.ps1
50+
```
51+
52+
The track configuration must pass configlet's linter, and the JSON files must be formatted with configlet's formatter:
53+
54+
```bash
55+
bin/configlet lint
56+
bin/configlet fmt --update
57+
```
58+
59+
When adding an exercise or an approach, generate any new UUIDs with configlet:
60+
61+
```bash
62+
bin/configlet uuid
63+
```
64+
65+
Practice-exercise test files are generated from the canonical data in [`problem-specifications`][problem-specifications]; edit the generator in `generators/exercises/` and regenerate:
66+
67+
```bash
68+
bin/generate <slug>
69+
```
70+
2971
[guidelines]: https://exercism.org/blog/contribution-guidelines-nov-2023
3072
[zig-forum]: https://forum.exercism.org/c/programming/zig/199
3173
[building-tracks]: https://exercism.org/docs/building/tracks
3274
[style]: https://exercism.org/docs/building/markdown/style-guide
3375
[unnecessary-test-runs]: https://exercism.org/docs/building/tracks#h-avoiding-triggering-unnecessary-test-runs
76+
[configlet]: https://github.com/exercism/configlet
77+
[problem-specifications]: https://github.com/exercism/problem-specifications

0 commit comments

Comments
 (0)