Skip to content

Conversation

@NelsonBN
Copy link
Member

Added error handling options to improve the experience in CI/CD

Checklist before requesting a review

  • I have performed a self-review of my code.
  • Implemented tests for new features.
  • I tested the features already implemented.
  • Added usage examples in the readme.

@NelsonBN NelsonBN requested a review from Copilot June 22, 2025 12:17
@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Jun 22, 2025

Test Summary

196 tests   196 ✅  0s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit 907438d.

♻️ This comment has been updated with latest results.

This comment was marked as outdated.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@NelsonBN NelsonBN requested a review from Copilot June 22, 2025 12:20

This comment was marked as outdated.

@github-actions

This comment has been minimized.

@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
PBReporter 97% 82% 881
Summary 97% (851 / 880) 82% (607 / 742) 881

@github-actions
Copy link

@sonarqubecloud
Copy link

@NelsonBN NelsonBN requested a review from Copilot June 22, 2025 12:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds two new error-handling CLI options to the compare command, enabling configurable exit codes for warnings and threshold hits, updates the command implementation, tests, and documentation accordingly.

  • Introduce --fail-on-warnings and --fail-on-threshold-hit options and wire them into ComparerCommand.Execute
  • Update existing tests and add new tests for the error-handling behavior
  • Refresh README and constants to reflect new exit codes and usage

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Options/FailOnWarningsOption.cs & FailOnThresholdHitOption.cs New option classes defining the two error-handling flags
src/Commands/ComparerCommand.cs Extend Execute signature and implement exit-code logic
src/Models/Constants.cs Define new exit-code constants for warnings and threshold hits
tests/**/*ToolCommandsTest.cs & OptionsTests.cs/etc. Update expected option counts, invoke new flags in tests
tests/**/*ComparerCommandTests.cs Extend command invocation in existing tests; missing combined scenario
README.md Add documentation for new error-handling options and exit codes
Comments suppressed due to low confidence (4)

README.md:186

  • The description for --fail-on-warnings is incorrect: it should mention exiting on warnings rather than thresholds.
* (`-fw`, `--fail-on-warnings`): Exit with error code when any threshold is hit during comparison. **[default: disabled]**

README.md:255

  • The exit-code values listed here (1 and 2) don’t match the constants (WARNING = 2, THRESHOLD_HIT = 3). Update to align with the actual codes.
* **1**: Warnings detected (when `--fail-on-warnings` is enabled)

tests/PowerUtils.BenchmarkDotnet.Reporter.Tests/Commands/ComparerCommandTests.cs:933

  • Add a test covering the scenario where both --fail-on-warnings and --fail-on-threshold-hit are enabled and both warnings and threshold hits occur, to verify that warnings take priority.
    public void When_Comparison_Generate_Warning_And_FailOnWarnings_Is_False_Should_Return_Success_ExitCode()

tests/PowerUtils.BenchmarkDotnet.Reporter.Tests/Options/OptionsTests.cs:136

  • [nitpick] Two statements are on the same line—split into separate lines for readability.
        var compareCommand = toolCommands.Subcommands.Single(c => c.Name == "compare");        var option = compareCommand.Options.Single(o => o.Name == "--fail-on-warnings");

@NelsonBN NelsonBN merged commit 8a70b68 into main Jun 22, 2025
9 checks passed
@NelsonBN NelsonBN deleted the feat/add-fail-comparer-options branch June 22, 2025 12:34
@NelsonBN
Copy link
Member Author

🎉 This PR is included in version 1.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant