exercism / v2-configlet

Tool to assist in managing Exercism language tracks.
MIT License
16 stars 23 forks source link

Better error message if unlocked_by is not an exercise #123

Open tejasbubane opened 6 years ago

tejasbubane commented 6 years ago

In the javascript track config, collatz-conjecture exercise has unlocked_by set to "null" - which is not an exercise.

The error message shown is:

The exercise 'collatz-conjecture' is being unlocked by a non-core exercise. Non-core exercises can only be unlocked by core exercises.

This could be improved to tell that "null" is not an exercise. Can be also useful in case of typos in the exercise slug.

$ ./bin/configlet version
configlet version 3.8.0
nywilken commented 6 years ago

@tejasbubane thanks for the feedback. We wanted to try an avoid having additional checks for determining if a slug is an actual exercise as the non-core check would account for thst problem. But I do see the reasoning around including the exercise name, especially “null”.

Would you be open to messaging like the one below?

The exercise ‘exercise-slug’ is being unlocked by ‘other-exercise-slug’, which is not core. Non-core exercises can only be unlocked by core track exercises

tuxagon commented 6 years ago

@nywilken, something worth noting about this error message is that I wanted to include the non-core unlocked_by name, but the check function that all the lint functions use has a signature of func(track.Track) []string here. I did not want to go changing the signature and working outside the linter's pattern, despite me agreeing with @tejasbubane that a better message can be achieved.

I thought I'd drop this here so that it can be discussed and a possible solution found.

kytrinyx commented 6 years ago

One thing we might be able to do is have an error message function for each lint function that takes the slug of the exercise, and then can do extra work if necessary to put together a useful error message, if that makes sense (I haven't actually looked at the code recently, and this might be hard to do).