reviewdog / action-rubocop

Run rubocop with reviewdog 🐶
MIT License
115 stars 75 forks source link

Rubocop info severity causes build failure #75

Closed macosgrove closed 1 year ago

macosgrove commented 2 years ago

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.