jenkinsci/violation-comments-to-gitlab-plugin

Let report log level to be configured per violationConfig

Opened this issue · 2 comments

Currently the minSeverity can be only set globally. It would be nice to configure it per violationConfig, since some kind of reports can be more important than others. For example i am interested in all Checkstyle violations, but only interested in error Android LINT violations.
We cannot configure the plugin this way currently.

The syntax could be:

violationConfigs: [
  [ pattern: '.*/checkstyle/.*\\.xml$', parser: 'CHECKSTYLE', reporter: 'Checkstyle', minSeverity: 'ERROR'],
  [ pattern: '.*/reports/lint-results.*\\.xml$', parser: 'ANDROIDLINT', reporter: 'AndroidLint', minSeverity: 'WARN']
]

Run the plugin twice to achieve this:

step([
 $class: 'ViolationsToGitLabRecorder',
 config: [
 ...
 minSeverity: 'WARN',
 ...
 violationConfigs: [
  [ pattern: '.*/reports/lint-results.*\\.xml$', parser: 'ANDROIDLINT', reporter: 'AndroidLint', minSeverity: 'WARN']
 ]
])

step([
 $class: 'ViolationsToGitLabRecorder',
 config: [
 ...
 minSeverity: 'ERROR',
 ...
 violationConfigs: [
  [ pattern: '.*/checkstyle/.*\\.xml$', parser: 'CHECKSTYLE', reporter: 'Checkstyle', minSeverity: 'ERROR']
 ]
])

And a heads up on keepOldComments attribute. Having it set to false in the second step above will make that step remove comments from the first step above. So set it to true in the second step.