-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support reviewdog command line argument changes (--fail-level) #72
base: main
Are you sure you want to change the base?
Conversation
a324957
to
091455a
Compare
Co-authored-by: Shoma Okamoto <[email protected]>
Co-authored-by: Shoma Okamoto <[email protected]>
Optional. The level of failures that will cause the action to fail [any,info,warning,error]. | ||
|
||
The default is `error`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description hasn't been fixed yet. Please fix 🙏
It might be better to use the same sentence as in action-rubocop.
Optional. The level of failures that will cause the action to fail [any,info,warning,error]. | |
The default is `error`. | |
Optional. If set to none, always use exit code 0 for reviewdog. Otherwise, exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to the given level. Possible values: [none, any, info, warning, error] Default is none. | |
The default is `none`. |
ref. https://github.com/reviewdog/action-rubocop?tab=readme-ov-file#inputs
if [[ -n "${INPUT_FAIL_LEVEL}" ]]; then | ||
fail_level="--fail-level=${INPUT_FAIL_LEVEL}" | ||
elif [[ "${INPUT_FAIL_ON_ERROR}" = "true" ]]; then | ||
# For backward compatibility, default to any if fail-on-error is true | ||
# Deprecated | ||
fail_level="--fail-level=any" | ||
else | ||
fail_level="" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think it makes sense for reviewdog users to include conditional branching based on options.
The reviewdog code seems to include code to take care when fail-on-error is true. You can just pass the two options as is and there will be no problem.
func failLevel(opt *option) reviewdog.FailLevel {
if opt.failOnError {
slog.Warn("reviewdog: -fail-on-error is deprecated. Use -fail-level=any, or -fail-level=error for github-[pr-]check reporter instead. See also https://github.com/reviewdog/reviewdog/blob/master/CHANGELOG.md")
if opt.failLevel == reviewdog.FailLevelDefault {
switch opt.reporter {
default:
return reviewdog.FailLevelAny
case "github-check", "github-pr-check":
return reviewdog.FailLevelError
}
}
}
return opt.failLevel
}
reviewdog/reviewdog#1854
https://github.com/reviewdog/action-rubocop/blob/master/script.sh#L135-L136
Support reviewdog command line argument changes.
New: support fail-level
Deprecated: fail-on-error
See: #70
See also: https://github.com/reviewdog/reviewdog/blob/master/CHANGELOG.md#rotating_light-deprecation-warnings