Fix GitHub advisory YAML indentation#1092
Conversation
Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
|
Is it needed to reinvent the yaml lint/format? Can't we use some existing tooling to make it happen? |
|
Good question. I did check the existing path before going this route: the repo currently has related:
url:
- https://example.test/a
patched_versions:
- ">= 3.0.1"So this PR is not trying to replace a formatter that is already wired in; it is a narrow post-process around Psych output, with a round-trip guard before writing it. That said, I agree that a real formatter would be preferable if the project is comfortable adding one. I can look for a small existing tool that fits the repo and rework this, or keep this limited to generated GitHub advisory output if avoiding another dependency is the priority. |
Fixes #1091.
This updates the GitHub advisory sync output so generated sequence values under advisory keys are indented under their parent key, including:
patched_versionsrelated.urlThe formatter validates that reindented YAML parses back to the same data before using it, so nested raw GitHub payloads and multiline scalar text do not get silently rewritten if a shape is not safe to reformat.
Verification: