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

Add script for formatting/sorting YAML files #1237

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

garyhtou
Copy link
Member

@garyhtou garyhtou commented Aug 13, 2024

This PR adds a bin/format script that uses bash and yq to format & sort the YAML files.

It first checks the zones in config/production.yaml to see which files contain DNS declarations. Then, it uses yq to sort the keys and pretty print.

The script also provides a small diffstat when ran.

@garyhtou
Copy link
Member Author

It looks like the dry run passed with the yq formatted files. That's a good sign!

@Muirrum
Copy link
Member

Muirrum commented Aug 14, 2024

Is this intended to supersede #1129 ?

@garyhtou
Copy link
Member Author

Oops, I hadn't realized that there was already another PR open! Feel free to do whatever you'd like with this PR.

I'll clean up the merge conflict in case anyone plans to merge this

```
Formatting hackclub.com.yaml
 hackclub.com.yaml |  512 +++++++++++++++++++++++++------------------------------
 1 file changed, 242 insertions(+), 270 deletions(-)

Formatting hackclub.org.yaml
 hackclub.org.yaml |   43 +++++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 22 deletions(-)

Formatting hackclub.io.yaml
 hackclub.io.yaml |   44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

Formatting hackedu.us.yaml
 hackedu.us.yaml |   36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

Formatting hack.af.yaml
 hack.af.yaml |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Formatting bulckcah.com.yaml
 bulckcah.com.yaml |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Formatting dino.icu.yaml
 dino.icu.yaml |  378 +++++++++++++++++++++++------------------------------------
 1 file changed, 151 insertions(+), 227 deletions(-)

Formatting dinosaurbbq.org.yaml
 dinosaurbbq.org.yaml |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Formatting hack.club.yaml

Formatting hackclub.app.yaml
 hackclub.app.yaml |   64 +++++++++++++++++++++++++++----------------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

Formatting hackfoundation.org.yaml
 hackfoundation.org.yaml |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Formatting wackclub.com.yaml
 wackclub.com.yaml |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Formatting bank.engineering.yaml
 bank.engineering.yaml |  102 +++++++++++++++++++++++++--------------------------
 1 file changed, 51 insertions(+), 51 deletions(-)

Formatting scrap.dev.yaml
 scrap.dev.yaml |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Formatting scrapbook.dev.yaml
 scrapbook.dev.yaml |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Formatting cpu.land.yaml
 cpu.land.yaml |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

Formatting aisafety.dance.yaml
 aisafety.dance.yaml |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Formatting nonprofit.new.yaml
```
@garyhtou garyhtou marked this pull request as ready for review August 15, 2024 21:52
@garyhtou garyhtou requested review from a team as code owners August 15, 2024 21:52
@Muirrum
Copy link
Member

Muirrum commented Aug 16, 2024

I think the one thing this PR is missing is a check script that can be run with CI to make sure the format doesn't break through future PRs. If that happens I think this would be great :)

@northeastprince
Copy link
Contributor

I already had that in my PR, but if there's a reason it wasn't merged I'm happy to make changes or turn this over to @garyhtou.

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