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

MinAlertLevel (or similar) should control exit code #933

Open
1 task done
l0b0 opened this issue Dec 15, 2024 · 1 comment
Open
1 task done

MinAlertLevel (or similar) should control exit code #933

l0b0 opened this issue Dec 15, 2024 · 1 comment

Comments

@l0b0
Copy link

l0b0 commented Dec 15, 2024

Check for existing issues

  • Completed

Describe the feature

I configured Vale using pre-commit in a repo, and thought I had fixed everything once pre-commit stopped reporting issues. But as it turns out:

  1. pre-commit hides output for successful hooks when run without --verbose. This is a reasonable default to avoid noise from linters not following the "no output means everything's good" guideline.
  2. vale only returns a non-zero exit code on errors, not on MinAlertLevel and higher levels.

This was surprising, since I expected that if anything is alerted, there should be a non-zero exit code.

As for the implementation, changing MinAlertLevel to also control the exit code changes the semantics, which would necessitate a new version. On the other hand, adding a separate MinAlertLevelControlsExitCode flag or MinExitCodeLevel option (with the same possible values as MinAlertLevel and defaulting to error) is additional complexity.

The solution suggested in #575 seems to require kinda clunky implementation (based on this):

vale "$@" | awk 'BEGIN {status = 1} 1; END {if(/^✔/) status = 0; exit(status)}'
@bdovaz
Copy link

bdovaz commented Jan 10, 2025

Same problem here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants