Skip to content

rubocop-git exits with status 1 with disabled cops #39

Description

@tcollier

I have rubocop-git in my CI build process and it's breaking despite the lack of offenses. The output and return value for rubocop-git looks like

rubocop-git --display-cop-names master
#
# 14 files inspected, no offenses detected
echo $?
# 1

To debug this code, I printed out the violations variable after https://github.com/m4i/rubocop-git/blob/master/lib/rubocop/git/runner.rb#L13

[#<struct RuboCop::Git::FileViolation
  filename="spec/models/web_monitor/processes_count_spec.rb",
  offenses=
   [#<RuboCop::Cop::Offense:0x00007fa29e055648
     @cop_name="RSpec/InstanceVariable",
     @location=#<Parser::Source::Range spec/models/web_monitor/processes_count_spec.rb 676...692>,
     @message="RSpec/InstanceVariable: Use `let` instead of an instance variable.",
     @severity=#<RuboCop::Cop::Severity:0x00007fa29e055620 @name=:convention>,
     @status=:disabled>]>]

This points to a violation for a disabled cop causing the failure. The code at the location specified in the violation is spec/models/web_monitor/processes_count_spec.rb:28:48, which is shown below.

  end

  after do
    # rubocop:disable InstanceVariable
    Rails.application.config.heroku_app_name = @heroku_app_name
    # rubocop:enable InstanceVariable
  end

  describe '#successful?' do
    context 'when quantity is above threshold' do
      it { is_expected.to be_successful }
    end

    context 'when quantity is equal to threshold' do
      let(:quantity) { 3 }

      it { is_expected.to be_successful }
    end

    context 'when quantity is below threshold' do
      let(:quantity) { 2 }

      it { is_expected.to_not be_successful }
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions