-
-
Notifications
You must be signed in to change notification settings - Fork 554
Remove unneeded nesting #1798
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
Remove unneeded nesting #1798
Conversation
7c61def
to
df51e30
Compare
df51e30
to
36e3acf
Compare
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.
Yeah, I mentioned this when updating JS to spec. Agreed that THIS is the best time to do this.
I think there are many more exercises for which we'd have to make the same change. Here is an incomplete list: |
I'd like to get all those fixed in this PR too. I'll take a little time to find all of them. |
See previous discussion: #1671 |
I think the following bash script finds all these unneeded nesting exercises:
This outputs:
|
e5f44af
to
f393a65
Compare
f393a65
to
97fd158
Compare
I found 18 exercises for which there was unneeded nesting, which I've removed in this PR. Each exercise has its own commit to make reviewing easier. |
As far as I know, this PR flattened 2 levels of Are there any This PR probably broke most generators for these exercises. Do we have a list of tracks that use generators so that we can let some maintainers know? |
No idea. It's less likely, but I'll check next week.
Nope, unfortunately we don't. |
Just discovered that it broke Python. Took me a while to figure out what was going on, but glad I found this issue. Working on it now. 😆 |
Sorry about that @BethanyG! It will have broken more tracks, but we made this change to fix this slightly annoying issue now, when all tracks are in flux anyway. |
This commit updates our tests of the configlet binary to use the latest `problem-specifications` commit. We do this because we want the update that removes unnecessary nesting [1] before we make configlet write each tests.toml `description` in a longer form that shows nesting (see #301). [1] exercism/problem-specifications#1798
Some exercises in the `problem-specifications` repo have a `canonical-data.json` file that uses nesting, meaning that there is more than one `cases` property. `configlet` handled these nicely, but each `description` in each `tests.toml` file contained only the description of the test case itself. This could be unclear, and was especially confusing when test cases in different nested objects had the same description. Each `description` is purely for humans to read - it isn't used otherwise. With this commit, `configlet sync` writes the "full description" to the `tests.toml` file. For example, a `tests.toml` for the `triangle` exercise might previously contain (omitting other test cases for clarity): ```toml [3022f537-b8e5-4cc1-8f12-fd775827a00c] description = "sides may be floats" [adb4ee20-532f-43dc-8d31-e9271b7ef2bc] description = "sides may be floats" [26d9d59d-f8f1-40d3-ad58-ae4d54123d7d] description = "sides may be floats" ``` But with this commit: ```toml [3022f537-b8e5-4cc1-8f12-fd775827a00c] description = "equilateral triangle → sides may be floats" [adb4ee20-532f-43dc-8d31-e9271b7ef2bc] description = "isosceles triangle → sides may be floats" [26d9d59d-f8f1-40d3-ad58-ae4d54123d7d] description = "scalene triangle → sides may be floats" ``` For the canonical data for this exercise, see: https://github.com/exercism/problem-specifications/blob/f17f457fdc06/exercises/triangle/canonical-data.json We decided that putting everything in `description` is better than: - adding extra key/value pair(s) named e.g. `category` or `super` - adding TOML comments - using sub-tables While working on this PR, we noticed that 18 exercises in `problem-specifications` had unnecessary nesting. We simplified them in exercism/problem-specifications#1798 Closes: #202 Co-authored-by: ee7 <[email protected]>
The canonical data for
isogram
andprime-factors
contain nesting, but as there is only one level of nesting, this does not add any value.This can break test generators, but as everything is still in flux anyway, I think this is a good time to do this.
Note: please don't squash merge to retain the individual commits