1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/documentation/docs/steps/checksPublishResults.md
Christopher Fenner c9e2a09ca1
fix(docs): typo in sample parameter (#2433)
* fix typo

* add code blocks
2020-11-30 08:57:48 +01:00

4.9 KiB

${docGenStepName}

${docGenDescription}

Prerequisites

  • static check result files - To use this step, there must be static check result files available.
  • installed warnings-ng plugin

${docGenParameters}

aggregation

deprecated, do not use

tasks

parameter mandatory default possible values
pattern no '**/*.java'
archive no true true, false
high no 'FIXME'
normal no 'TODO,REVISE,XXX'
low no
qualityGates no [[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]] see QualityGates

pmd

parameter mandatory default possible values
pattern no '**/target/pmd.xml'
archive no true true, false
qualityGates no [[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]] see QualityGates

cpd

parameter mandatory default possible values
pattern no '**/target/cpd.xml'
archive no true true, false
qualityGates no [[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]] see QualityGates

findbugs

parameter mandatory default possible values
pattern no '**/target/findbugsXml.xml, **/target/findbugs.xml'
archive no true true, false
qualityGates no [[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]] see QualityGates

checkstyle

parameter mandatory default possible values
pattern no '**/target/checkstyle-result.xml'
archive no true true, false
qualityGates no [[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]] see QualityGates

eslint

parameter mandatory default possible values
pattern no '**/eslint.jslint.xml'
archive no true true, false
qualityGates no [[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]] see QualityGates

pylint

parameter mandatory default possible values
pattern no '**/pylint.log'
archive no true true, false
qualityGates no [[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]] see QualityGates

${docGenConfiguration}

${docJenkinsPluginDependencies}

QualityGates

It is possible to define quality gates to set the build result to FAILURE (not stop the build) on a certain count of findings. To achieve this, just define your quality gates as followed for the specific check tool:

qualityGates: [
  [threshold: 1, type: 'TOTAL_HIGH', unstable: false],
  [threshold: 10, type: 'TOTAL_NORMAL', unstable: false],
  [threshold: 100, type: 'TOTAL_LOW', unstable: false],
  [threshold: 1000, type: 'TOTAL', unstable: false],
]

This way, the quality gate will fail on 1 high issue, 10 normal issues, 100 low issues or a total issue count of 1000.

The qualityGates parameter can be set for tasks, pmd, cpd, findbugs, checkstyle, eslint and pylint.

checksPublishResults(
    tasks: true,
    pmd: [pattern: '**/target/pmd-results.xml', qualityGates: [[threshold: 101, type: 'TOTAL_LOW', unstable: true]]],
    cpd: [archive: false],
    archive: true
)

See also the official plugin documentation for further information.

StaticChecks Thresholds

Side effects

none

Exceptions

none

Example

// publish java results from pmd, cpd, checkstyle & findbugs
checksPublishResults archive: true, pmd: true, cpd: true, findbugs: true, checkstyle: true
// publish javascript results from ESLint
checksPublishResults archive: true, eslint: [pattern: '**/result-file-with-fancy-name.xml']
// publish scala results from scalastyle
checksPublishResults archive: true, checkstyle: [pattern: '**/target/scalastyle-result.xml']
// publish python results from pylint
checksPublishResults archive: true, pylint: [pattern: '**/target/pylint.log']