Originally created by @StefMa on GitHub (Nov 18, 2025).
I'm not an CLI nor an exit code expert.
But when I run pkl format -w . I realize that it exit with 11 (violation found).
This is also documented:
However, I think a CLI should only return non zero in case of an error in the process.
It should not return non zero in case the CLI (format) tool runs successfully, but found problems.
For the shell's purposes, a command which exits with a zero exit status has succeeded. A nonzero exit status indicates failure.
For me it sounds like "a non exit code means the program doesn't behave correctly, failed for some reaasons".
But it is not! It just found violation errors. This is his job 🤷😁
What do you think?
Originally created by @StefMa on GitHub (Nov 18, 2025).
I'm not an CLI nor an exit code expert.
But when I run `pkl format -w .` I realize that it exit with 11 (violation found).
This is also documented:
<img width="809" height="373" alt="Image" src="https://github.com/user-attachments/assets/f7e7a289-5358-4a5b-b4d8-c6a1f86a89e3" />
However, I think a CLI should only return non zero in case of an **error in the process**.
It should not return non zero in case the CLI (format) tool runs successfully, but found problems.
Looking also into wikipedia about [Exit status](https://en.wikipedia.org/wiki/Exit_status):
> For the shell's purposes, a command which exits with a zero exit status has succeeded. A nonzero exit status indicates failure.
For me it sounds like "a non exit code means the program doesn't behave correctly, failed for some reaasons".
But it is not! It just found violation errors. This is his job 🤷 😁
What do you think?
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @StefMa on GitHub (Nov 18, 2025).
I'm not an CLI nor an exit code expert.
But when I run
pkl format -w .I realize that it exit with 11 (violation found).This is also documented:
However, I think a CLI should only return non zero in case of an error in the process.
It should not return non zero in case the CLI (format) tool runs successfully, but found problems.
Looking also into wikipedia about Exit status:
For me it sounds like "a non exit code means the program doesn't behave correctly, failed for some reaasons".
But it is not! It just found violation errors. This is his job 🤷 😁
What do you think?
@thejcannon commented on GitHub (Dec 3, 2025):
Looking at other file formatters:
ruff format(
ruff format --checkandruff format)gofmt(
gofmt -dandgofmt -w)shfmt(
shfmt -dandshfmt -w)rustfmt(
rustfmt --checkandrustfmt)yamlfmt(
yamlfmt -lintandyamlfmt)taplo format(
taplo format --checkandtaplo format)pkl format(
pkl format --diff-name-onlyandpkl format -w)@bioball commented on GitHub (Dec 3, 2025):
@thejcannon thanks for the comparison! I'm convinced that we should just change this.
@thejcannon commented on GitHub (Dec 6, 2025):
Thanks for the quick update. ♥️