Open gasche opened 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.
Ok, wouldn't be too difficult. In the meantime, you can use diff -q FILE <(ocp-indent FILE)
I wonder what the output should be of --check
should be. I have two use-cases in mind:
0
when it works, and some error code when --check
fails)ocp-indent --check **/*.ml*
, or find . -name '*.ml*' | xargs ocp-indent --check
, to know whether all the OCaml source files around me are correctly indented. Then I would expect a greppable textual output, for example something like "ocp-indent --check %S: %s" filename (if ok then "pass" else "fail")
. Another (better?) option would be to print nothing when the file is correct, and print failure message(s) when it is incorrect; I think users would easily understand this convention, and it is convenient for multi-file processing.My preference would be to have:
--check
is correct, and a 0 return code--check
finds a discrepancy, and a non-0 return codepeople 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
I would like to ask ocp-indent: is my file (or the range specified etc.) correctly indented?