-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
lint(track_config): check status-dependent exercise rules #415
lint(track_config): check status-dependent exercise rules #415
Conversation
0e11380
to
fe5df29
Compare
@ee7 -- Since I am here and in cleanup mode anyways, I'll PR a fix for the ones you found for Python. 😄 And..many thanks for adding these checks into configlet! |
Great, thanks. I've created the PRs for elixir and zig. So here are the relevant PRs: |
prereqs
, concepts
, practices
prerequisites
, concepts
, practices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. I've left a minor nit.
src/lint/track_config.nim
Outdated
result = &"The {exerciseKind} {q exercise.slug} {statusStr}" & | ||
&", but has {problem}" | ||
|
||
proc checkExercisePCP(exercises: seq[ConceptExercise] | seq[PracticeExercise]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is PCP
? To me this is a non-intuitive abbreviation so I'd prefer it being spelled out a bit more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is PCP?
Indeed. I'll try to improve it.
("practices, concepts, prerequisites")
I don't think I've found a great factoring here yet - in particular I don't like the proc names. For the first pass we have a proc called
Where we will extend/add procs for the second pass to add the remaining
So the names might need to change later too. But I'll try to improve the current situation a little. |
👍 I'm fine with renaming later BTW. |
With this commit, `configlet lint` now checks that a track-level `config.json` file follows the below rules: - The `exercises.concept[].concepts` value must be a non-empty array of strings if `exercises.concept[].status` is not equal to "deprecated" - The `exercises.concept[].concepts` value must be an empty array if `exercises.concept[].status` is equal to "deprecated" - The `exercises.concept[].prerequisites` value must be an empty array if `exercises.concept[].status` is equal to "deprecated"
With this commit, `configlet lint` now checks that a track-level `config.json` file follows the below rules: - The `exercises.practice[].practices` value must be a non-empty array of strings if `exercises.practice[].status` is not equal to "deprecated" - The `exercises.practice[].practices` value must be an empty array if `exercises.practice[].status` is equal to "deprecated" - The `exercises.practice[].prerequisites` value must be a non-empty array of strings if `exercises.practice[].status` is not equal to "deprecated" - The `exercises.practice[].prerequisites` value must be an empty array if `exercises.practice[].status` is equal to "deprecated"
With this commit, `configlet lint` now checks that a track-level `config.json` file follows the below rule: - The `exercises.practice[].prerequisites` value must be an empty array if `exercises.practice[].slug` is equal to "hello-world"
With this commit, `configlet lint` now checks that a track-level `config.json` file follows the below rule: - The `exercises.concept[].prerequisites` value must be a non-empty array of strings if `exercises.concept[].status` is not equal to "deprecated", except for exactly one exercise which is allowed to have an empty array as its value
…ces` There is too much output otherwise.
fe5df29
to
92d1906
Compare
prerequisites
, concepts
, practices
With this commit,
configlet lint
now checks that a track-levelconfig.json
file follows the below rules for Concept Exercises:exercises.concept[].concepts
value must be a non-empty array ofstrings if
exercises.concept[].status
is not equal todeprecated
exercises.concept[].concepts
value must be an empty array ifexercises.concept[].status
is equal todeprecated
exercises.concept[].prerequisites
value must be a non-emptyarray of strings if
exercises.concept[].status
is not equal todeprecated
, except for exactly one exercise which is allowed to havean empty array as its value
exercises.concept[].prerequisites
value must be an empty arrayif
exercises.concept[].status
is equal todeprecated
and these rules for Practice Exercises:
exercises.practice[].practices
value must be an empty array ifexercises.practice[].status
is equal todeprecated
exercises.practice[].prerequisites
value must be an empty arrayif
exercises.practice[].status
is equal todeprecated
exercises.practice[].prerequisites
value must be an empty arrayif
exercises.practice[].slug
is equal tohello-world
This commit also adds support for the below checks of
Practice Exercises. However, because there would currently be too many
linting errors, this commit leaves these checks disabled for now:
exercises.practice[].practices
value must be a non-empty arrayof strings if
exercises.practice[].status
is not equal todeprecated
exercises.practice[].prerequisites
value must be a non-emptyarray of strings if
exercises.practice[].status
is not equal todeprecated
Closes: #386
This PR currently includes the commit from #414. We will merge that one PR first, then rebase this PR on top.Edit: done.At the time of writing (
2021-09-06T18:27:00Z
), this PR causes the below diff to the output ofconfiglet lint
, per track:elixir
https://github.com/exercism/elixir/blob/d5f3834445ca/config.json#L1153-L1338
python
https://github.com/exercism/python/blob/6afbd74d3bce/config.json#L1971-L2190
zig
https://github.com/exercism/zig/blob/3d166c4e2a7a/config.json#L21-L36