stylish-haskell
stylish-haskell copied to clipboard
feature request: indicate whether a file needs reformatting rather than reformatting it
A Debian Developer wants to incoporate stylish-haskell into a program called check-all-the-things which performs various automated tests on code. For this purpose, it would be useful if stylish-haskell had a flag, e.g. --dry-run
, which caused it to print the names of files that would be changed during a normal run, without any files actually being changed. So you could do stylish-haskell --dry-run src/*
or something like that.
+1. I think it would be awesome for stylish-haskell to have this built in.
(Sorry if this is publicity, but I feel that it's relevant) I wrote a generic formatter that can link to any other binary and supports this functionality - see https://github.com/hjwylde/omnifmt. It further provides a diff
mode that tells you what changes it would make. There's an example of how to use it with stylish-haskell there.
+1
This would be very useful to us as well.
For other linters/formatters I've seen this referred to as "check" mode, which only returns a status code of 0 if nothing has to be changed, to make CI integrations as seamless as possible.
Actually it appears this feature already exists via exit_code: error_on_format
in the yaml file, particularly when combined with -r
, it just isn't documented.