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

Rubocop info severity causes build failure #75

Closed
macosgrove opened this issue May 27, 2022 · 0 comments · Fixed by #84
Closed

Rubocop info severity causes build failure #75

macosgrove opened this issue May 27, 2022 · 0 comments · Fixed by #84
Labels
help wanted Extra attention is needed

Comments

@macosgrove
Copy link

macosgrove commented May 27, 2022

I have an info level Rubocop issue. It is reported as such in the reviewdog github action:

Screen Shot 2022-05-27 at 12 01 34 pm

Expected behaviour: Reviewdog should report the issue but pass the build.
Actual behaviour: Build is failing.

I can see that reviewdog concludes this is a failure:

2022/05/27 01:54:05 [rubocop] reported: https://github.com/bettercaring/better_caring/runs/6619239483 (conclusion=failure)

I have set rubocop fail level flag on my github workflow reviewdog action configuration:

      - name: rubocop
        uses: reviewdog/action-rubocop@v1
        with:
          github_token: ${{ secrets.github_token }}
          rubocop_version: gemfile
          rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
          filter_mode: added
          rubocop_flags: '--fail-level E'

I also tried uses: reviewdog/action-rubocop@v2 but that resulted in two reports, both at error level:
Screen Shot 2022-05-27 at 12 08 31 pm

I have upgraded to rubocop version 1.30.0.
I have written a script to report the rubocop version and exit code, which results in:

$ tmp/rubo.sh
1.30.0
.rubocop.yml:23: `IgnoredMethods` is concealed by line 25
Inspecting 1 file
I

Offenses:

app/controllers/lobbies_controller.rb:64:5: I: Naming/MemoizedInstanceVariableName: Memoized variable @lobby does not match method name find_or_create_lobby_by_conversation. Use @find_or_create_lobby_by_conversation instead.
    @lobby ||= Lobbies::FindOrCreateService.new(conversation: conv, user: current_target).process
    ^^^^^^

1 file inspected, 1 offense detected

Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
  * rubocop-graphql (https://rubygems.org/gems/rubocop-graphql)
  * rubocop-rake (https://rubygems.org/gems/rubocop-rake)

You can opt out of this message by adding the following to your config (see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
  AllCops:
    SuggestExtensions: false
0

You can see here that the Rubocop exit code is 0, as hoped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
2 participants