Open kbroch-rivosinc opened 1 week ago
Love that idea. As mentioned in Issue #246, it might also be nice to have the keys sorted in YAML files to ensure scripted changes produce reasonable diffs (Since different YAML libraries will likely emit in different orders).
I did some exploration of yaml formatting with following tools:
Here's my findings:
yq --inplace '... | sort_keys(.)'
My recommendation based on this would be to move ahead with prettier formatting and writing a custom script to enforce keyword sorting with a specific ordering for some keyword if needed.
Discussed this more with maintainers and going to reduce the number of hooks in this initial PR to just very simple:
The other hooks in this initial can then be put in later PRs.
Consistently formatted yaml, json, etc makes it easier for multiple developers and reduces git diffs.
Formatting and linting that can be run on at git commit time with a git hook, reduces the need for this later in PRs (Github action can be used to confirms that it was done)
There are tools to manage pre-commit hooks like:
Since this project is a multilingual project:
I would suggest using pre-commit to manage the hooks but I'm open to exploring other tooling. (I do realize that since pre-commit is python based I'd be adding another language to the dev dependencies)
I'm happy to put in a PR once the discussion done.