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
[WIP] Implement JSON validation for all-contributors data #3619
base: main
Are you sure you want to change the base?
Conversation
|
✅ Deploy Preview for the-turing-way ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Welcome @gandrewgabriel! Thanks for tagging the @the-turing-way/infrastructure-working-group, @JimMadge to get this reviewed and checked! |
Thanks @gandrewgabriel ! 🎉
Is that something you would like to learn? It might be possible for someone from the @the-turing-way/infrastructure-working-group to mentor or co-work with you on that. |
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.
This looks good enough to me. I have a couple of nitpicks about hard-coded paths but that could be addressed in a follow-up PR, so I won't block on it.
I'd be happy to co-work with you to introduce these scripts into CI if you're interested?
|
||
# Load the schema specification that the all-contributors JSON must follow | ||
contributor_schema = None | ||
with open("./tests/all-contributors.schema.json") as f: |
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.
Given that we've already imported pathlib, I'd rather use that library to construct a path dynamically rather than rely on hardcoding it here
parser.add_argument( | ||
"--all-contributors-filepath", | ||
type=str, | ||
default="./.all-contributorsrc", |
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.
Another hard-coded path I'd like to avoid if at all possible
Hi @sgibson91, @gandrewgabriel, @JimMadge - just checking in with a friendly ping to remind you about this PR! No rush, but our Book Dash week might be a good time to push this forward 🚀 |
Absolutely, this can be a target for me during Book Dash! |
Summary
Partially addresses #3549
The script checks for two kinds of problems in the all-contributors JSON: firstly, is the file parsable JSON (to catch problems caused by, for example, missing commas); and secondly, do the contents of the file match the schema required by all-contributors.
The schema I've added only checks the content of the "contributors" property. The other metadata in the JSON file is not validated against a schema, but errors in JSON syntax will be detected anywhere in the file.
I don't know enough about how the CI works, so I haven't made any changes there. When this validation script is ready for action, maybe someone else can add it to the CI pipeline.
What should a reviewer concentrate their feedback on?
Acknowledging contributors
The following people should be added to the table of contributors in the README file: @gandrewgabriel