Add a pre-check stage before running our parser. We use PyYAML to parse the file, walk the syntax tree and check for violations (currently: ambiguous scalars like yes and unquoted strings like foo). We error out if we find any, or attempt to fix them if --fix is passed.
This brings two advantages:
Better UX: Rather than reporting a single violation, making the user fix it and run the linter again, then reporting the next one - a process so tedious that I'm confident it will completely prohibit adoption if it's the norm - we can report lots of violations at once.
Simpler parser: First, we can strip the fix_* logic out of our parser. Second, all YAML that makes it to the parser is guaranteed to have quoted strings. I suspect this is going to be a win for simplicity.
Add a pre-check stage before running our parser. We use PyYAML to parse the file, walk the syntax tree and check for violations (currently: ambiguous scalars like
yes
and unquoted strings likefoo
). We error out if we find any, or attempt to fix them if--fix
is passed.This brings two advantages:
Better UX: Rather than reporting a single violation, making the user fix it and run the linter again, then reporting the next one - a process so tedious that I'm confident it will completely prohibit adoption if it's the norm - we can report lots of violations at once.
Simpler parser: First, we can strip the
fix_*
logic out of our parser. Second, all YAML that makes it to the parser is guaranteed to have quoted strings. I suspect this is going to be a win for simplicity.