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: add more linting rules for track config.json #183

Merged
merged 16 commits into from
Feb 19, 2021
Merged

Conversation

ErikSchierboom
Copy link
Member

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.

  • refactor: create module for track config.json validation
  • lint: add validator to check boolean property
  • lint: add validator to check integer property
  • lint: validate basic property of track config.json file
  • lint: valid tags property of track config.json file
  • lint: update output of applied rules

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
Copy link
Member

@ee7 ee7 left a 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.

"used_for/web_development"
]
"used_for/web_development",
].toHashSet()
Copy link
Member Author

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 🤦

@ErikSchierboom
Copy link
Member Author

I'm fine with track_config.nim. Can you update?

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.
@ErikSchierboom ErikSchierboom merged commit cc0128c into main Feb 19, 2021
@ErikSchierboom ErikSchierboom deleted the lint-tags branch February 19, 2021 14:24
@ErikSchierboom
Copy link
Member Author

Squashed and merged

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

Successfully merging this pull request may close these issues.

2 participants