breml / logstash-config

logstash-config provides a parser and abstract syntax tree (AST) for the Logstash config format, written in Go
Apache License 2.0
40 stars 10 forks source link

mustache format: dont rewrite file if there is no changes #14

Open oneingan opened 2 years ago

oneingan commented 2 years ago

I'd like to use mustache format with https://github.com/numtide/treefmt then linters/formatters need to follow some specs. mustache format does right everyone except:

If, and only if, a file format has changed, the formatter MUST write the new content in place of the original file.

I also check mustache lint makes it right, but I prefer to use mustache format to ignore plugin-id errors.

I'd like to help with a PR, but notice lint and format apps are not so similar in go code.

breml commented 2 years ago

@uningan Thanks for reaching out. I have no objection against changing the behavior of mustache format such that the target file is only written, if the content changes. I am happy to review a PR.