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
2019-04-09 19:46:23 +02:00

4.3 KiB

${docGenStepName}

${docGenDescription}

Prerequisites

${docGenParameters}

aggregation

parameter mandatory default possible values
thresholds no none see thresholds

tasks

parameter mandatory default possible values
pattern no '**/*.java'
archive no true true, false
high no 'FIXME'
normal no 'TODO,REVISE,XXX'
low no
thresholds no none see thresholds

pmd

parameter mandatory default possible values
pattern no '**/target/pmd.xml'
archive no true true, false
thresholds no none see thresholds

cpd

parameter mandatory default possible values
pattern no '**/target/cpd.xml'
archive no true true, false
thresholds no none see thresholds

findbugs

parameter mandatory default possible values
pattern no '**/target/findbugsXml.xml, **/target/findbugs.xml'
archive no true true, false
thresholds no none see thresholds

checkstyle

parameter mandatory default possible values
pattern no '**/target/checkstyle-result.xml'
archive no true true, false
thresholds no none see thresholds

eslint

parameter mandatory default possible values
pattern no '**/eslint.jslint.xml'
archive no true true, false
thresholds no none see thresholds

pylint

parameter mandatory default possible values
pattern no '**/pylint.log'
archive no true true, false
thresholds no none see thresholds

${docGenConfiguration}

Thresholds

It is possible to define thresholds to fail the build on a certain count of findings. To achive this, just define your thresholds a followed for the specific check tool:

thresholds: [fail: [all: 999, low: 99, normal: 9, high: 0]]

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

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

checksPublishResults(
    tasks: true,
    pmd: [pattern: '**/target/pmd-results.xml', thresholds: [fail: [low: 100]]],
    cpd: [archive: false],
    aggregation: [thresholds: [fail: [high: 0]]],
    archive: true
)

StaticChecks Thresholds

Side effects

If both ESLint and PyLint results are published, they are not correctly aggregated in the aggregator plugin.

Exceptions

none

Example

// publish java results from pmd, cpd, checkstyle & findbugs
checksPublishResults archive: true, pmd: true, cpd: true, findbugs: true, checkstyle: true, aggregation: [thresholds: [fail: [high: 0]]]
// publish javascript results from ESLint
checksPublishResults archive: true, eslint: [pattern: '**/result-file-with-fancy-name.xml'], aggregation: [thresholds: [fail: [high: 0, normal: 10]]]
// 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']