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 running rubocop step if rubocop command itself fails #60

Closed
Slike9 opened this issue Dec 9, 2021 · 5 comments
Closed

Fail running rubocop step if rubocop command itself fails #60

Slike9 opened this issue Dec 9, 2021 · 5 comments

Comments

@Slike9
Copy link
Contributor

Slike9 commented Dec 9, 2021

If rubocop command itself fails, e.g. because of incorrect rubocop config, the step is considered successful. The error or rubocop command is ignored because of the following pipe (|) operator: https://github.com/reviewdog/action-rubocop/blob/master/script.sh#L96.

Can we fail the step in such case? Otherwise we risk to get not pleasant situation: the checks are green, we think our code is correct, but actually the code is not even checked.

@Slike9
Copy link
Contributor Author

Slike9 commented Dec 9, 2021

The problem here is we can't fail the step on any rubocop error status. When rubocop detects offenses, it also returns error status.

@wafuwafu13
Copy link
Contributor

wafuwafu13 commented Dec 10, 2021

@Slike9

Can you recreate the situation "If rubocop command itself fails, e.g. because of incorrect rubocop config, the step is considered successful."?

I tried with the incorrect rubocop config, but it failed as expected.
https://github.com/wafuwafu13/GitHub-Actions-PlayGround/actions/runs/1563039678

reviewdog: failed to unmarshal rdjson (DiagnosticResult): proto: syntax error (line 1:1): unexpected token

I think It's not as if this action doesn't work as expected because of the presence of pipe (|) operator.

@Slike9
Copy link
Contributor Author

Slike9 commented Dec 10, 2021

@wafuwafu13 thank you a lot for your help. You are right action-rubocop@v2 works fine. I'm sorry for wasting your time, for not providing enough information, for not providing repro. In our project we were using action-rubocop@v1, not v2, that had the issue; repro: https://github.com/Slike9/GitHub-Actions-PlayGround/runs/4485488149?check_suite_focus=true. I should have to test my workflow against the last version of the action.

So, I'm closing the issue.

@Slike9 Slike9 closed this as completed Dec 10, 2021
@Slike9
Copy link
Contributor Author

Slike9 commented Dec 10, 2021

It looks the issue was fixed by https://github.com/reviewdog/action-rubocop/pull/48/files#diff-116b4e2bac3e35befdfae3f3b6eb88911689c30bfe6696d9e6b0139da8cb5e72R95-R96 (switching from rubocop to rdjson formatter).

@wafuwafu13
Copy link
Contributor

thank you for your imformation :-)

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

2 participants