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(validators): support top-level array #218

Merged
merged 2 commits into from
Mar 18, 2021

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Mar 11, 2021

So far, none of the files we were linting were an array at the top level. But links.json is.

Some possible future refactorings:

  • Use common logic for all the "missing key" conditions.
  • Make the arrayOfStrings procs extend the array procs.
  • Make the empty string unnecessary in isObject(data, "", path).

This PR is still a bit WIP, and I'm not set on its approach yet. But it might soon be good enough for now.

I need to do the below before I merge this PR:

  • Fix the bug that makes configlet lint produce an error
  • Verify that this PR does not change the output of configlet lint

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Use common logic for all the "missing key" conditions.
Make the arrayOfStrings procs extend the array procs.
Make the empty string unnecessary in isObject(data, "", path).

Those are all nice refactorings for the future.

src/lint/concept_exercises.nim Show resolved Hide resolved
src/lint/validators.nim Show resolved Hide resolved
This is one way of allowing us to lint a JSON file that is an array at
the top level - for example, `links.json`.
@ee7 ee7 force-pushed the lint-support-top-level-array branch from 6cebabe to fbec735 Compare March 18, 2021 10:30
@ee7 ee7 force-pushed the lint-support-top-level-array branch from fbec735 to 934047b Compare March 18, 2021 11:35
@ee7 ee7 merged commit 8f9bd28 into exercism:main Mar 18, 2021
@ee7 ee7 deleted the lint-support-top-level-array branch March 18, 2021 12:02
@ee7 ee7 changed the title lint: support top-level array lint(validators): support top-level array Mar 18, 2021
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