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

auto-sort and format library.json after a push #115

Merged
merged 16 commits into from
Dec 31, 2023
Merged

auto-sort and format library.json after a push #115

merged 16 commits into from
Dec 31, 2023

Conversation

bmos
Copy link
Contributor

@bmos bmos commented Dec 20, 2023

Parses json, sorts by manufacturer+model, and writes back to file (eliminating trailing whitespace, fixing alphabetizing, and other jank)

@bmos
Copy link
Contributor Author

bmos commented Dec 20, 2023

Feel free to close this if you have a different approach in mind. I'm hoping this is enough to get the automation working, since it looks like device submissions are really taking off!

@bmos bmos changed the title Sort+format manually-submitted pull requests auto-sort and format library.json after a push Dec 21, 2023
@andrew-codechimp
Copy link
Owner

Thanks for your continued interest in this, I will have a look at this soon, the sorting will be useful as I'm hitting a lot of PR's that don't come sorted.

@ThomDietrich
Copy link
Contributor

Little improvement suggestion: As "battery_quantity" is optional I expect some PRs to introduce a json error in which "battery_type" has a superfluous or missing comma. Could your script default to name the "battery_type" last? @andrew-codechimp wdyt?

@andrew-codechimp
Copy link
Owner

andrew-codechimp commented Dec 22, 2023

@ThomDietrich I'm not seeing too many people having an extra last comma
@bmos has done some great work on a device issue template which would make it far easier but not quite ready yet and I'm still catching up on features to look at this, GH actions are really frustrating to test.

@bmos
Copy link
Contributor Author

bmos commented Dec 26, 2023

One thing I have noticed is that some JSON characters are being automatically escaped that are not escaped by some folks who contribute manually.

@andrew-codechimp
Copy link
Owner

I do a trial json load before updating the library so they will at least be caught if they were going to cause a problem.

@andrew-codechimp
Copy link
Owner

Now that I've done with the large features I may get some time to look at this more.
Trying out issues/pr's/scripts on a fork is a little dangerous.
I've created a temp repo and invited you as a contributor, that way we can try as many edits as we want without danger.
The repo is up to date with your patch and the main branch here.
https://github.com/andrew-codechimp/bn-device-test

@bmos bmos closed this Dec 28, 2023
@bmos bmos reopened this Dec 28, 2023
@bmos
Copy link
Contributor Author

bmos commented Dec 31, 2023

In merging main back into my branch here, I overwrote what I had in my library file with what you have in main in case I had messed anything up during testing.

@bmos
Copy link
Contributor Author

bmos commented Dec 31, 2023

It should be all ready for a merge, although I didn't add the new script folder you made:
https://github.com/andrew-codechimp/bn-device-test/tree/main/.github/scripts/library_doc

I'm happy to do it, but figured this way that commit could come from you as the author.

@andrew-codechimp andrew-codechimp merged commit 8f7b1d9 into andrew-codechimp:main Dec 31, 2023
4 checks passed
@andrew-codechimp
Copy link
Owner

I've just added the scripts and merged.
Thanks for all your work on this, it will hopefully make the library grow and save me a lot of time.

I'm leaving the other repo hanging about so I can test stuff in future, if you want to test any changes feel free to over there.

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.

3 participants