-
-
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: add more linting rules for track config.json #183
Conversation
The properties validated are: - language: non-empty string (required) - slug: non-empty string (required) - blurb: non-empty string (required) - active: boolean (required) - version: integer (required)
This signals to the reader that the tags are known at compile-time.
Otherwise, it always performs 36 string comparisons for every input tag.
Nim supports trailing commas here, and this reduces the diff if we ever add more tags underneath.
Put only names to the right to avoid possible ambiguity with "version and tags fields".
I think this makes it easier: - for us to compare our code to the spec and see which fields we currently check. - for end users to compare the success message output with their config.json file and see which fields haven't been checked. See the order in the spec: https://github.com/exercism/docs/blob/main/anatomy/tracks/configlet/linting.md#rule-configjson-file-is-valid
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.
Non-blocking comment: Can we think of a better name than track.nim
? I think:
- it's too close to
src/sync/tracks.nim
- it sounds like it handles linting the whole track, when actually it just handles the root
config.json
file
I'm fine with something like these:
track_config.nim
root_config.nim
or whatever you like.
Otherwise LGTM - approved, conditional on squashing at merge-time.
src/lint/track.nim
Outdated
"used_for/web_development" | ||
] | ||
"used_for/web_development", | ||
].toHashSet() |
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.
Doh. I should have come up with this myself 🤦
I'm fine with |
This avoids confusion with `src/sync/tracks.nim` and makes it clearer that the file just handles linting of the root `config.json` file, not the whole track.
Squashed and merged |
This PR adds some more linting rules for the track's config.json.
I'm not really happy with our error messages, but we can improve that later on. At this stage, it is important to just have some validation.