Since the primary purpose of this tool right now is to validate configuration file syntax it would be beneficial to have the validator tool to not only identify syntax issues but also fix them. This would be a fairly big undertaking and would likely have to come with "no warranty" - at least until the schema validation changes are incorporated into this tool [Link story here when created]. We'd have to determine if we want to fix the files in place (maybe requiring an extra flag), create new files, or display the changes in stdout like gofmt does by default.
Fixing the syntax errors would likely require implementing a loop that would repeatedly fix then validate until everything was correct. If a fix could not be determined it would provide an error stating why it couldn't be fixed (and revert back to the original file or work out of a temp file and only change the orig file when it passed validation.
A less aggressive implementation could be to output recommendations in the reporter output rather than actually trying to fix things.
Description
Since the primary purpose of this tool right now is to validate configuration file syntax it would be beneficial to have the validator tool to not only identify syntax issues but also fix them. This would be a fairly big undertaking and would likely have to come with "no warranty" - at least until the schema validation changes are incorporated into this tool [Link story here when created]. We'd have to determine if we want to fix the files in place (maybe requiring an extra flag), create new files, or display the changes in stdout like gofmt does by default.
Fixing the syntax errors would likely require implementing a loop that would repeatedly fix then validate until everything was correct. If a fix could not be determined it would provide an error stating why it couldn't be fixed (and revert back to the original file or work out of a temp file and only change the orig file when it passed validation.
A less aggressive implementation could be to output recommendations in the reporter output rather than actually trying to fix things.