Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI check does not return an error code when problems are found #159

Closed
Swandog opened this issue Oct 16, 2023 · 2 comments
Closed

CLI check does not return an error code when problems are found #159

Swandog opened this issue Oct 16, 2023 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@Swandog
Copy link

Swandog commented Oct 16, 2023

I installed the CLI on Mac using Homebrew, then tried to run the check subcommand on my faulty file. But, despite it detecting problems, the heylogs process returned a true (0) value:

lace on 🌱 master [$] via 🐍 v3.11.5 on ☁️  (us-east-1)
❯ heylogs check CHANGELOG.md
CHANGELOG.md
  55:1  error  Missing ref link  all-h2-contain-a-version

  1 problem

lace on 🌱 master [$] via 🐍 v3.11.5 on ☁️  (us-east-1)
❯ echo $?
0

(We discovered a similar problem when using the suggested pattern in a GitHub action, i.e.

- uses: jbangdev/jbang-action@v0.110.1
  with:
    script: com.github.nbbrd.heylogs:heylogs-cli:_VERSION_:bin
    scriptargs: "check CHANGELOG.md"

does not fail CI if the CHANGELOG.md does not pass the check)

It would be nice for the check command to return an error if the check fails, or if there was an option to cause that behavior (e.g., a CLI option like --exit-with-error-on-errors, but maybe less verbose/clunky)

@charphi charphi added the bug Something isn't working label Oct 17, 2023
@charphi
Copy link
Member

charphi commented Oct 17, 2023

You are right; the CLI should return an error code.
The error code should be -1 aka CommandLine.ExitCode.SOFTWARE

@charphi charphi added this to the 0.7.1 milestone Oct 17, 2023
@charphi
Copy link
Member

charphi commented Oct 17, 2023

Done in bb364ab

@charphi charphi closed this as completed Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants