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

fail-on-error=false (or left on default) still exits 1 using Github checks #1407

Open
ohookins opened this issue Apr 19, 2023 · 0 comments
Open

Comments

@ohookins
Copy link

I may have misunderstood the code, so if I have then my apologies. My expectation for -fail-on-error=false or leaving the option out entirely (which should default to false) is that reviewdog will error with return code 0 in all situations except if an internal error or misconfiguration occurs. This is clearly not happening:

reviewdog: Reporting results for "rspec"
  reviewdog: found at least one result in diff
  Error: [rspec] reported by reviewdog 🐶
<redacted test case output>

  Raw Output:
<redacted test case output>
Error: Process completed with exit code 1.

This doubles the number of test fail annotations we have on every Github Actions run, as well as making the overall effect much harder to understand since it is more noisy.

It seems that the option to fail on error is properly handled for Github Actions runs in postResultSet:

if opt.failOnError && (res.Conclusion == "failure") {
return fmt.Errorf("[%s] Check conclusion is %q", name, res.Conclusion)
}

And yet in reportResults the logic appears to mandate exiting non-zero if we have anything that is at the error level:

// If it's not running in GitHub Actions, reviewdog should exit with 1
// if there are at least one result in diff regardless of error level.
shouldFail = shouldFail || !cienv.IsInGitHubAction() ||
!(results.Level == "warning" || results.Level == "info")

Perhaps there's an error in the logic? I'm running it in Github Actions, so logic short-circuiting is not active and passes through to the comparison to the result.Level. If the result.Level is error, the last section of this statement evaluates to true and we end up with an error. Indeed, if it is not running in Github Actions it seems like it will exit non-zero irrespective of the result.Level which doesn't match the comment's intention. Unless I'm misreading this?

This issue may also be related to the following, although I'm not positive:

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

No branches or pull requests

1 participant