Document situation to be signaled

Lame formatters cannot distinguish between when there are syntax errors and
when code should be reformatted.
This commit is contained in:
Michael Wolf
2024-10-30 21:59:40 -06:00
parent 44fd5a350f
commit c4cac19501
2 changed files with 6 additions and 2 deletions

View File

@@ -159,6 +159,8 @@ As output, this script should emit whatever the programs it calls emit.
- 0: file wouldn't be reformatted
- 1: file would be reformatted
- 2: file has at least one syntax error
- 3: file would be reformatted or it has at least one syntax error but we
cannot distinguish which
- 252: Unexpected return value from the tool; that is, the value of `$?` is
unexpected and thus unhandled
- 253: Unexpected output from the tool; that is, the output emitted by the
@@ -176,8 +178,8 @@ Even less unsurprisingly, Laravel pint gets it worse than all the others I
checked; it doesn't distinguish files that need to be reformatted from files
with actual syntax errors.
Anyway, `gofmt` is the obviously the model to follow. So we should
probably drop `1`.)
If possible, then, we should return 1 or 2 when relevant. When they can't be
distinguished, return 3.)
### in `do_format` mode