stylish-haskell icon indicating copy to clipboard operation
stylish-haskell copied to clipboard

feature request: indicate whether a file needs reformatting rather than reformatting it

Open spwhitton opened this issue 8 years ago • 4 comments

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.

spwhitton avatar May 27 '16 03:05 spwhitton

+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.

hjwylde avatar May 27 '16 04:05 hjwylde

+1

th3coop avatar Mar 04 '21 22:03 th3coop

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.

tysonzero avatar Apr 14 '22 01:04 tysonzero

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.

tysonzero avatar Apr 14 '22 07:04 tysonzero