OCamlPro / ocp-indent

Indentation tool for OCaml, to be used from editors like Emacs and Vim.
http://www.typerex.org/ocp-indent.html
Other
200 stars 63 forks source link

`--check` option to merely check that `--inplace` would be a no-op #196

Open gasche opened 8 years ago

gasche commented 8 years ago

I would like to ask ocp-indent: is my file (or the range specified etc.) correctly indented?

js-guest commented 8 years ago

This is a feature we'd like at Jane Street as well! On Oct 29, 2015 3:38 AM, "Gabriel Scherer" notifications@github.com wrote:

I would like to ask ocp-indent: is my file (or the range specified etc.) correctly indented?

— Reply to this email directly or view it on GitHub https://github.com/OCamlPro/ocp-indent/issues/196.

AltGr commented 8 years ago

Ok, wouldn't be too difficult. In the meantime, you can use diff -q FILE <(ocp-indent FILE)

gasche commented 8 years ago

I wonder what the output should be of --check should be. I have two use-cases in mind:

My preference would be to have:

vogler commented 7 years ago

people may want to use this check in a git commit hook, but I have no experience with this so I don't know what kind of interface would be convenient (I suppose return values are fine).

I'm using it like this: https://github.com/goblint/analyzer/blob/master/scripts/hooks/pre-commit#L52