Repository navigation
An unknown --fail-on value is an error instead of quietly meaning error - #25
Merged
Merged
Conversation
`--fail-on warnings` (or WARNING, or err) used to fall through to the default, error: a pipeline that asked to block on warnings let them pass and believed it was guarded. cdclint now exits 2 before reading anything, names the value and lists error, warning, info, as --disable already does for an unknown rule. The GitHub Action passed its input through unchanged, and an empty input (a workflow templating an unset variable) used to mean error. It still does: action.yml substitutes error for an empty input, so only a value that names no severity fails the step. Rejected: accepting other spellings (warnings, WARNING). A gate's threshold is worth spelling exactly; an alias table is one more thing to document, and the error message says what to write.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
--fail-onaccepts exactlyerror,warningorinfo.cdclint: --fail-on: unknown severity "warnings"; the severities are error, warning, info.error, so--fail-on warningslet warnings pass silently.action.yml: an emptyfail-oninput still meanserror, as it did before (${FAIL_ON:-error}). A workflow that passes an unset variable keeps working, and only a value that names no severity fails the step.Test first
TestAnUnknownFailOnIsAnErrorNotTheDefaultfailed on main forwarnings,WARNING,errand"": exit 1 with findings printed. Now each is exit 2 with nothing on stdout.include-list-typo(one error and one warning).Verified
gofmt -l .is clean;go vet,go buildandgo test ./...pass (Docker, golang:1.25-bookworm).--base HEAD:--fail-on warningand--fail-on error:0 error(s), 0 warning(s), 162 info. These are the two valuestools/cdclint.shpasses.--fail-on warnings: rejected with the message above.errorunderset -u.Rejected
Accepting other spellings (
warnings,WARNING). A gate's threshold is worth spelling exactly, and the error message says what to write.Not in this PR
--formathas the same fall-through: an unknown value prints text. That is visible rather than silent, so it is left for its own change if you want it.