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

lint: check that concept exercise has correct concepts array #386

Closed
taiyab opened this issue Jul 2, 2021 · 3 comments · Fixed by #415
Closed

lint: check that concept exercise has correct concepts array #386

taiyab opened this issue Jul 2, 2021 · 3 comments · Fixed by #415

Comments

@taiyab
Copy link

taiyab commented Jul 2, 2021

https://exercism.lol/tracks/rust/exercises/csv-builder

image

This learning exercise doesn't teach any concepts. Need to deal with edge cases like this.

@iHiD
Copy link
Member

iHiD commented Jul 2, 2021

This is a bug in the track. @ErikSchierboom @ee7 does configlet catch this (or is planned to catch it)? If not, it should.

@iHiD iHiD transferred this issue from exercism/v3-beta Jul 2, 2021
@ee7
Copy link
Member

ee7 commented Jul 2, 2021

does configlet catch this

Not yet.

(or is planned to catch it)?

Yeah. From #249:

Rule: config.json file is valid

The config.json file should have the following checks:

  • ...
  • 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" values must match the "concepts.slug" property of one of the concepts

It looks like this issue is actually due to the latter item. From the relevant lines in Rust's config.json:

      {
        "slug": "csv-builder",
        "name": "CSV builder",
        "difficulty": 1,
        "uuid": "10c9f505-9aef-479f-b689-cb7959572482",
        "concepts": [
          "string-vs-str"
        ],

We see that the exercise's concepts array is non-empty, but no item in the top-level concepts array has a slug with the value string-vs-str.

A bunch of these edge cases aren't checked yet. Sorry. I've been in configlet sync-land for a while.

@ee7 ee7 changed the title [Exercise] Learning exercise that teaches no concepts lint: check that concept exercise has correct concepts array Jul 2, 2021
@ee7 ee7 added the cmd: lint label Jul 2, 2021
@iHiD
Copy link
Member

iHiD commented Jul 3, 2021

Thanks for the info!

ee7 added a commit that referenced this issue Sep 5, 2021
With this commit, `configlet lint` now checks that a track-level
`config.json` file follows the below rules:

- The `exercises.concept[].concepts` values must not be in any other
  concept exercise's `concepts` property
- The `exercises.concept[].concepts` values must match the
  `concepts.slug` property of one of the concepts
- The `exercises.concept[].prerequisites` values must match the
  `concepts.slug` property of one of the concepts

These rules currently apply to user-facing Concept Exercises only, which
are those with `status` of `active` or `beta`.

Related: #386
@ee7 ee7 closed this as completed in #415 Sep 7, 2021
ee7 added a commit that referenced this issue Sep 7, 2021
With this commit, `configlet lint` now checks that a track-level
`config.json` file follows the below rules for Concept Exercises:

- 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 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
- The `exercises.concept[].prerequisites` value must be an empty array
  if `exercises.concept[].status` is equal to `deprecated`

and these rules for Practice Exercises:

- 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 an empty array
  if `exercises.practice[].status` is equal to `deprecated`
- The `exercises.practice[].prerequisites` value must be an empty array
  if `exercises.practice[].slug` is equal to `hello-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:

- 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[].prerequisites` value must be a non-empty
  array of strings if `exercises.practice[].status` is not equal to
  `deprecated`

Closes: #386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants