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

Validate all-contributors JSON. #3549

Open
2 tasks
JimMadge opened this issue Feb 23, 2024 · 10 comments
Open
2 tasks

Validate all-contributors JSON. #3549

JimMadge opened this issue Feb 23, 2024 · 10 comments
Labels
good first issue Good issue for newcomers to fix or respond to infrastructure For all issues related to book infrastructure

Comments

@JimMadge
Copy link
Member

Summary

Add a CI job to validate the all-contributors.rc JSON file.
Mistakes in this file can cause the table to be rendered incorrectly.

What needs to be done?

Who can help?

  • Anyone interested in CI and doing a little programming

Updates

@JimMadge JimMadge added good first issue Good issue for newcomers to fix or respond to infrastructure For all issues related to book infrastructure labels Feb 23, 2024
@gedankenstuecke
Copy link
Collaborator

I wonder if an alternative solution would just be to have the CI run the all-contributors CLI tool (to try) to build the updated contributor table? That would highlight any issues with the file itself and could also be a way to ensure that the table in the readme & the source file are in sync?

(Happy to be told that this isn't a great idea due to consequences I hadn't thought about!)

@JimMadge
Copy link
Member Author

I think not quite. There are cases where all-contributors will run but the input isn't "correct" which results in odd looking tables. There is an example here.

@gedankenstuecke
Copy link
Collaborator

Gotcha, my (wrong) assumption was that the CLI tool would validate the JSON as part of the build process!

The alternative explanation could be though that the validation for that broken JSON would still have passed? Maybe it would be worth running that broken file through the validator to check if that would indeed catch it?

@JimMadge
Copy link
Member Author

Yes, actually I'm not 100% sure what the CLI does there. It might recognise that the JSON is wrong, but does it's best effort. Or, the JSON may be valid JSON, just not conforming correctly to the schema so the behaviour is undefined.

If we can use the CLI to catch and flag these problems, it would be better than introducing new code.

@sgibson91
Copy link
Member

Does the CLI have a validate subcommand? That would be the easiest place to start

@gedankenstuecke
Copy link
Collaborator

I fear it doesn't! I thought all-contributors check might do that, but instead it's used to check to compare contributors from GitHub with the ones credited in your .all-contributorsrc file, to make sure that credit is given where it's due.

My guess would be that all-contributors generate fails if the json is borked, but as @JimMadge pointed out for that it needs to be broken enough 🙈

@sgibson91
Copy link
Member

Man, if it wasn't written in JS, I'd contribute so many features upstream to this bot (I just don't have time to learn the language)

@JimMadge
Copy link
Member Author

Man, if it wasn't written in JS, I'd contribute so many features upstream to this bot (I just don't have time to learn the language)

💯

There are JS implementations of JSON Schema.

@aleesteele
Copy link
Member

aleesteele commented Apr 4, 2024

Just had this exact issue in #3592 ! Definitely demonstrates the need.

@gandrewgabriel
Copy link
Contributor

Hi all - I've got a WIP script that might get us closer to sorting this. Opening a PR shortly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for newcomers to fix or respond to infrastructure For all issues related to book infrastructure
Projects
Status: No status
Development

No branches or pull requests

5 participants