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

[WIP] Implement JSON validation for all-contributors data #3619

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gandrewgabriel
Copy link

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?

  • Everything looks ok?
  • Scripts are suitable for CI use?

Acknowledging contributors

The following people should be added to the table of contributors in the README file: @gandrewgabriel

Copy link

welcome bot commented Apr 17, 2024

Thank You Banner
💖 Thanks for opening this pull request! 💖 The Turing Way community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.
If you are submitting a new chapter, here are some things that will help get your pull request across the finish line! 🏁

  • Check you have removed all lorem ipsums from the chapter template (if you used it)
  • Check for any abbreviations or latin phrases (such as "e.g." or "i.e.") in your writing. See our style guide for more information on this topic.
  • Make sure you have added your new chapter to the Table of Contents

    We have Continuous Integration tests that check the writing style and will help you track down any slip-ups ♻ The Netlify bot will also comment with a preview of the book with your additions so you can see how it will look once it's merged! 🎉

    We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. If we don't acknowledge this pull request after 7 days, feel free to chat to us about it in our Slack workspace.

Copy link

netlify bot commented Apr 17, 2024

Deploy Preview for the-turing-way ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit d4c3ac1
🔍 Latest deploy log https://app.netlify.com/sites/the-turing-way/deploys/661fddc7cc8e6e0008b013d7
😎 Deploy Preview https://deploy-preview-3619--the-turing-way.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@JimMadge JimMadge requested a review from a team April 17, 2024 14:35
@aleesteele
Copy link
Member

Welcome @gandrewgabriel! Thanks for tagging the @the-turing-way/infrastructure-working-group, @JimMadge to get this reviewed and checked!

@JimMadge
Copy link
Member

Thanks @gandrewgabriel ! 🎉

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.

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.

@JimMadge JimMadge added the infrastructure For all issues related to book infrastructure label Apr 18, 2024
Copy link
Member

@sgibson91 sgibson91 left a 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:
Copy link
Member

@sgibson91 sgibson91 Apr 23, 2024

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

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

@aleesteele
Copy link
Member

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 🚀

@JimMadge
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure For all issues related to book infrastructure
Projects
Status: Pull Request (in progress)
Development

Successfully merging this pull request may close these issues.

None yet

4 participants