From 97b701784cfc0ff50faf28d78be91a6f90af0ff5 Mon Sep 17 00:00:00 2001 From: G-J van Rooyen Date: Tue, 27 Aug 2024 00:28:40 +0200 Subject: [PATCH] Small code fixes. Updated README. - Ran the code formatter on source files. - Rehaul of the README to follow Python's example. --- .github/workflows/test.yml | 16 +-- README.md | 130 +++++++++++++++--- bin/fetch-ols-odinfmt.sh | 4 +- exercises/practice/grains/grains.odin | 2 +- .../practice/leap/.meta/leap_example.odin | 2 +- exercises/practice/leap/leap.odin | 2 +- 6 files changed, 120 insertions(+), 36 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 653e687..a3abfaa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - name: Setup Odin - uses: laytan/setup-odin@v2 + uses: laytan/setup-odin with: token: ${{ secrets.GITHUB_TOKEN }} @@ -34,24 +34,12 @@ jobs: # The current setting pulls the latest version of Odin from the repo, and rebuilds it from # scratch. This is slow, and clutters the action's log. Rather ensure that the OS has the # right dependencies for a recent versioned release of the compiler. - release: false + release: dev-2024-08 llvm-version: 14 - name: Install project dependencies run: bin/fetch-configlet - - name: Run the project linter - run: bin/configlet lint - - name: Verify all exercises run: bin/verify-exercises - - - name: Apply code formatting to all .odin files - run: bin/format-all.sh - - - name: Commit and push changes - run: | - git config --global user.name 'G-J van Rooyen' - git config --global user.email 'gvrooyen@gmail.com' - git diff --quiet && git diff --staged --quiet || git commit -am "Automated formatting" && git push diff --git a/README.md b/README.md index 305f079..5d345ca 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,96 @@ # Odin -Official Exercism forum thread about this track: https://forum.exercism.org/t/new-track-odin-programming-language/7379 +
-Borrowing concepts from other C-based/C-adjacent language tracks: -- https://github.com/exercism/c -- https://github.com/exercism/zig +Hi.  👋🏽  👋  **We are happy you are here.**  🎉 🌟 + +
+ +**`exercism/odin`** is one of many programming language tracks on [Exercism](exercism-website). +This repo holds all the instructions, tests, code, and support files for Odin _exercises_ currently under development or implemented and available for students. + +🌟   Track exercises support the `dev-2024-08` release of Odin. + +Exercises are grouped into **concept** exercises which teach the Odin syllabus, which will eventually live [here][odin-syllabus], and **practice** exercises, which are unlocked by progressing in the syllabus tree  🌴 . +Concept exercises are constrained to a small set of language or syntax features. +Practice exercises are open-ended, and can be used to practice concepts learned, try out new techniques, and _play_. These two exercise groupings can be found in the track [config.json][config-json], and under the `odin/exercises` directory. + +

+ +
+ + + + + +🌟🌟  Please take a moment to read our [Code of Conduct][exercism-code-of-conduct] 🌟🌟  +It might also be helpful to look at [Being a Good Community Member][being-a-good-community-member] & [The words that we use][the-words-that-we-use]. + +                         Some defined roles in our community: [Contributors][exercism-contributors] **|** [Mentors][exercism-mentors] **|** [Maintainers][exercism-track-maintainers] **|** [Admins][exercism-admins] + +
+ +
+ + +Here to suggest a new feature or new exercise?? **Hooray!**  🎉   +We'd love if you did that via our [Exercism Community Forum][exercism-forum] where there is a [dedicated thread][odin-thread] for the new Odin track. +Please read [Suggesting Exercise Improvements][suggesting-improvements] & [Chesterton's Fence][chestertons-fence]. +_Thoughtful suggestions will likely result in faster & more enthusiastic responses from volunteers._ + +
+ + +✨ 🦄  _**Want to jump directly into Exercism specifications & detail?**_ +     [Structure][exercism-track-structure] **|** [Tasks][exercism-tasks] **|** [Concepts][exercism-concepts] **|** [Concept Exercises][concept-exercises] **|** [Practice Exercises][practice-exercises] **|** [Presentation][exercise-presentation] +     [Writing Style Guide][exercism-writing-style] **|** [Markdown Specification][exercism-markdown-specification] (_✨ version in [contributing][website-contributing-section] on exercism.org_) + +
+
+ +## Pre-launch Checklist +Here is a list of practice exercises that we aim to implement before the Odin track goes live on Exercism: + +- ~~Hello World~~ +- ~~Leap~~ +- ~~Difference of Squares~~ +- ~~Grains~~ +- Resistor Color +- Collatz Conjecture +- Queen Attack +- Darts +- Resistor Color Duo +- Hamming +- Space Age +- RNA Transcription +- Binary +- Eliud's Eggs +- Two Fer +- Raindrops +- D&D Character +- Perfect Numbers +- High Scores +- Pangram +- Resistor Color Trio +- Armstrong Numbers + +Other exercises are welcome too! +It is recommended that a track has 20 exercises or more (not counting "Hello World") to go live. ## Contributing an Exercise -The `bin/` subdirectory contains several scripts to help you contribute exercises that will run -correctly on Exercism: - -- `configlet` is a tool to help track maintainers with the maintenance of their track. Fetch it by - running the `bin/fetch-configlet` script. Run `bin/configlet lint` to verify that the track is - properly structured. -- `bin/fetch-ols-odinfmt.sh` will fetch the Odin language server (`ols`) that can assist with - verifying Odin code directly in your IDE. `odinfmt` is a tool that can format Odin code according - to the specification in `odinfmt.json`. `odinfmt` is automatically invoked by the build system +The `bin/` subdirectory contains several scripts to help you contribute exercises that will run correctly on Exercism: + +- `configlet` is a tool to help track maintainers with the maintenance of their track. + Fetch it by running the `bin/fetch-configlet` script. + Run `bin/configlet lint` to verify that the track is properly structured. +- `bin/fetch-ols-odinfmt.sh` will fetch the Odin language server (`ols`) that can assist with verifying Odin code directly in your IDE. + `odinfmt` is a tool that can format Odin code according to the specification in `odinfmt.json`. + Please run `odinfmt` before pushing your changes to the repository. whenever new code is pushed to the repository. - `bin/format-all.sh` will run `odinfmt` on all `.odin` files in the repository. -- `bin/run-test.sh` runs the tests for a specific exercise, or for all exercises if no exercise name is - provided. -- `bin/verify-exercises` checks the integrity of all exercises, including tests. It is used by the - build system whenever new code is pushed to the repository. +- `bin/run-test.sh` runs the tests for a specific exercise, or for all exercises if no exercise name is provided. +- `bin/verify-exercises` checks the integrity of all exercises, including tests. + It is used by the build system whenever new code is pushed to the repository. - `bin/gen-exercise.sh` can be used to generate a new exercise. More details follow below. ### Creating a New Exercise @@ -138,3 +207,30 @@ Basic linting finished successfully: - Required track docs are present - Required shared exercise docs are present ``` + +[being-a-good-community-member]: https://github.com/exercism/docs/tree/main/community/good-member +[chestertons-fence]: https://github.com/exercism/docs/blob/main/community/good-member/chestertons-fence.md +[concept-exercises]: https://github.com/exercism/docs/blob/main/building/tracks/concept-exercises.md +[config-json]: https://github.com/exercism/odin/blob/main/config.json +[exercise-presentation]: https://github.com/exercism/docs/blob/main/building/tracks/presentation.md +[exercism-admins]: https://github.com/exercism/docs/blob/main/community/administrators.md +[exercism-code-of-conduct]: https://exercism.org/docs/using/legal/code-of-conduct +[exercism-concepts]: https://github.com/exercism/docs/blob/main/building/tracks/concepts.md +[exercism-contributors]: https://github.com/exercism/docs/blob/main/community/contributors.md +[exercism-forum]: https://forum.exercism.org/ +[exercism-markdown-specification]: https://github.com/exercism/docs/blob/main/building/markdown/markdown.md +[exercism-mentors]: https://github.com/exercism/docs/tree/main/mentoring +[exercism-tasks]: https://exercism.org/docs/building/product/tasks +[exercism-track-maintainers]: https://github.com/exercism/docs/blob/main/community/maintainers.md +[exercism-track-structure]: https://github.com/exercism/docs/tree/main/building/tracks +[exercism-website]: https://exercism.org/ +[exercism-writing-style]: https://github.com/exercism/docs/blob/main/building/markdown/style-guide.md +[freeing-maintainers]: https://exercism.org/blog/freeing-our-maintainers +[practice-exercises]: https://github.com/exercism/docs/blob/main/building/tracks/practice-exercises.md +[prs]: https://github.com/exercism/docs/blob/main/community/good-member/pull-requests.md +[odin-release]: https://github.com/odin-lang/Odin/releases/tag/dev-2024-08 +[odin-syllabus]: https://exercism.org/tracks/odin/concepts +[odin-thread]: https://forum.exercism.org/t/new-track-odin-programming-language/7379 +[suggesting-improvements]: https://github.com/exercism/docs/blob/main/community/good-member/suggesting-exercise-improvements.md +[the-words-that-we-use]: https://github.com/exercism/docs/blob/main/community/good-member/words.md +[website-contributing-section]: https://exercism.org/docs/building diff --git a/bin/fetch-ols-odinfmt.sh b/bin/fetch-ols-odinfmt.sh index d0bda42..4b20857 100755 --- a/bin/fetch-ols-odinfmt.sh +++ b/bin/fetch-ols-odinfmt.sh @@ -1,7 +1,7 @@ #!/bin/bash # version="refs/heads/master" -version="46892948312c14b44600ae9f557e86bd8c792343" +version="e2f4f96cd46b70360f3caa58acc4af14eb0e8688" bin_dir="bin" name="ols" @@ -35,4 +35,4 @@ mv odinfmt .. popd > /dev/null rm -rf $tarball_dir -rm -f $tarball_path \ No newline at end of file +rm -f $tarball_path diff --git a/exercises/practice/grains/grains.odin b/exercises/practice/grains/grains.odin index a5d75bc..7873e02 100644 --- a/exercises/practice/grains/grains.odin +++ b/exercises/practice/grains/grains.odin @@ -2,7 +2,7 @@ package grains Error :: enum { // Implement me! - NotImplemented + NotImplemented, } // Returns the number of grains on the specified square. diff --git a/exercises/practice/leap/.meta/leap_example.odin b/exercises/practice/leap/.meta/leap_example.odin index ef60df0..24ce39b 100644 --- a/exercises/practice/leap/.meta/leap_example.odin +++ b/exercises/practice/leap/.meta/leap_example.odin @@ -2,7 +2,7 @@ package leap Error :: enum { None = 0, - NotImplemented + NotImplemented, } is_leap_year :: proc(year: int) -> (bool, Error) { diff --git a/exercises/practice/leap/leap.odin b/exercises/practice/leap/leap.odin index feac812..f22d96c 100644 --- a/exercises/practice/leap/leap.odin +++ b/exercises/practice/leap/leap.odin @@ -2,7 +2,7 @@ package leap Error :: enum { // Implement me! - NotImplemented + NotImplemented, } is_leap_year :: proc(year: int) -> (bool, Error) {