Reputation: 2289
I have set up Rubocop in my CI Bamboo build, however since there are offenses detected it has an Exit status of 1 which fails this task.
Since I am generating a Rubocop HTML report in the ci task I want the task to pass.
How can I stop rubocop from failing the task, is it something to do with:
--fail-level
Upvotes: 1
Views: 1576
Reputation: 2267
I've added this spec to my CI to check Syntax only.
require 'spec_helper'
RSpec.describe 'rubocop analysis' do
subject(:report) { `rubocop --only Lint/Syntax` }
it 'has no offenses' do
expect(report).to match(/no\ offenses\ detected/)
end
end
Upvotes: 0
Reputation: 2289
in the end:
'--fail-level F'
worked as a rubocop flag, so it will only fail if there are fatal errors. The docs are not clear on this.
Upvotes: 2
Reputation: 1837
If you want to ignore rubocop exit code and continue your CI pipeline you should || true
.
So if you are running rubocop like this:
$ rubocop
Then change it to:
$ rubocop || true
which will return exit code 0 and won't stop your pipeline.
Upvotes: 0