Collect rubocop warnings in jenkins

Currently, you need to have a look at the console output to find out, why a github PR is “red” even if all tests are successful. In the console output you see then, that rubocop prints some warnings.

Wouldn’t it be better to collect the rubocop warnings and handle them as a “test result”, like in:

https://philphilphil.wordpress.com/2016/12/28/using-static-code-analysis-tools-with-jenkins-pipeline-jobs/

1 Like

Quickly adding the notes I wrote on IRC about this.

https://wiki.jenkins.io/display/JENKINS/Warnings+Next+Generation+Plugin looks like the current warnings tool. In https://github.com/jenkinsci/warnings-ng-plugin/blob/master/SUPPORTED-FORMATS.md it mentions rubocop so in theory adding the following would work:

pipeline {
    post {
        always {
            recordIssues enabledForFailure: true, tool: ruboCop()
        }
    }
}
1 Like