feat: add --fail-on option to control failing severity#77
Merged
Conversation
Adds a --fail-on option to `dolphin check` that configures the lowest severity (error, warning, info) that causes a non-zero exit. Defaults to error, preserving existing behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a --fail-on option to dolphin check to control the lowest finding severity that produces a non-zero exit code, enabling stricter CI behavior when desired while keeping the default behavior unchanged.
Changes:
- Introduced
--fail-on {error|warning|info}option (default:error) to configure failure threshold. - Updated
CheckCommand.HandleAsyncto compute the exit code based on findings’ severities vs the configured threshold. - Added unit tests validating default behavior for WARNING findings and behavior when
--fail-on warningis provided.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Dolphin/Cli/CheckCommand.cs | Adds --fail-on option wiring and updates exit-code logic to use a severity threshold. |
| tests/Dolphin.Tests/CheckCommandTests.cs | Adds tests for WARNING findings under default threshold and --fail-on warning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address review feedback: compute the failing severities explicitly rather than relying on the Severity enum's ordinal ordering, and normalize the --fail-on input case-insensitively for direct callers. Add coverage for the info threshold and the option wiring. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address review feedback: lower-case the --fail-on value a single time in HandleAsync instead of per-finding inside Fails(), and remove the unused System.CommandLine.Parsing import from the tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
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.



Summary
Adds a
--fail-onoption todolphin checkthat configures the lowest finding severity that causes a non-zero exit code.--fail-on error(default) — fail only on ERROR findings (unchanged behavior)--fail-on warning— fail on ERROR or WARNING--fail-on info— fail on any findingValidated via
FromAmong, defaulterror. Exit logic compares each finding against the threshold using theSeverityenum ordering.Tests
Added tests confirming a WARNING finding returns 0 by default and 1 with
--fail-on warning.🤖 Generated with Claude Code