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
I have
rubocop-gitin my CI build process and it's breaking despite the lack of offenses. The output and return value forrubocop-gitlooks likeTo debug this code, I printed out the
violationsvariable after https://github.com/m4i/rubocop-git/blob/master/lib/rubocop/git/runner.rb#L13This 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.