github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/documentation/docs/steps/checksPublishResults.md (about) 1 # ${docGenStepName} 2 3 ## ${docGenDescription} 4 5 ## Prerequisites 6 7 * **static check result files** - To use this step, there must be static check result files available. 8 * installed [warnings-ng](https://plugins.jenkins.io/warnings-ng/) plugin 9 10 ## ${docGenParameters} 11 12 ### aggregation 13 14 deprecated, do not use 15 16 ### tasks 17 18 | parameter | mandatory | default | possible values | 19 | ----------|-----------|---------|-----------------| 20 | pattern | no | `'**/*.java'` | | 21 | archive | no | `true` | `true`, `false` | 22 | high | no | `'FIXME'` | | 23 | normal | no | `'TODO,REVISE,XXX'` | | 24 | low | no | | | 25 | qualityGates | no | `[[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]]` | see [QualityGates](#qualitygates) | 26 27 ### pmd 28 29 | parameter | mandatory | default | possible values | 30 | ----------|-----------|---------|-----------------| 31 | pattern | no | `'**/target/pmd.xml'` | | 32 | archive | no | `true` | `true`, `false` | 33 | qualityGates | no | `[[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]]` | see [QualityGates](#qualitygates) | 34 35 ### cpd 36 37 | parameter | mandatory | default | possible values | 38 | ----------|-----------|---------|-----------------| 39 | pattern | no | `'**/target/cpd.xml'` | | 40 | archive | no | `true` | `true`, `false` | 41 | qualityGates | no | `[[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]]` | see [QualityGates](#qualitygates) | 42 43 ### findbugs 44 45 | parameter | mandatory | default | possible values | 46 | ----------|-----------|---------|-----------------| 47 | pattern | no | `'**/target/findbugsXml.xml, **/target/findbugs.xml'` | | 48 | archive | no | `true` | true, false | 49 | qualityGates | no | `[[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]]` | see [QualityGates](#qualitygates) | 50 51 ### checkstyle 52 53 | parameter | mandatory | default | possible values | 54 | ----------|-----------|---------|-----------------| 55 | pattern | no | `'**/target/checkstyle-result.xml'` | | 56 | archive | no | `true` | `true`, `false` | 57 | qualityGates | no | `[[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]]` | see [QualityGates](#qualitygates) | 58 59 ### eslint 60 61 | parameter | mandatory | default | possible values | 62 | ----------|-----------|---------|-----------------| 63 | pattern | no | `'**/eslint.jslint.xml'` | | 64 | archive | no | `true` | `true`, `false` | 65 | qualityGates | no | `[[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]]` | see [QualityGates](#qualitygates) | 66 67 ### pylint 68 69 | parameter | mandatory | default | possible values | 70 | ----------|-----------|---------|-----------------| 71 | pattern | no | `'**/pylint.log'` | | 72 | archive | no | `true` | `true`, `false` | 73 | qualityGates | no | `[[threshold: 1, type: 'TOTAL_HIGH', unstable: false], [threshold: 1, type: 'TOTAL_ERROR', unstable: false]]` | see [QualityGates](#qualitygates) | 74 75 ## ${docGenConfiguration} 76 77 ## ${docJenkinsPluginDependencies} 78 79 ### QualityGates 80 81 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: 82 83 ```groovy 84 qualityGates: [ 85 [threshold: 1, type: 'TOTAL_HIGH', unstable: false], 86 [threshold: 10, type: 'TOTAL_NORMAL', unstable: false], 87 [threshold: 100, type: 'TOTAL_LOW', unstable: false], 88 [threshold: 1000, type: 'TOTAL', unstable: false], 89 ] 90 ``` 91 92 This way, the quality gate will fail on 1 high issue, 10 normal issues, 100 low issues or a total issue count of 1000. 93 94 The `qualityGates` parameter can be set for `tasks`, `pmd`, `cpd`, `findbugs`, `checkstyle`, `eslint` and `pylint`. 95 96 ```groovy 97 checksPublishResults( 98 tasks: true, 99 pmd: [pattern: '**/target/pmd-results.xml', qualityGates: [[threshold: 101, type: 'TOTAL_LOW', unstable: true]]], 100 cpd: [archive: false], 101 archive: true 102 ) 103 ``` 104 105 See also the [official plugin documentation](https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md#quality-gate-configuration) for further information. 106 107  108 109 ## Side effects 110 111 none 112 113 ## Exceptions 114 115 none 116 117 ## Example 118 119 ```groovy 120 // publish java results from pmd, cpd, checkstyle & findbugs 121 checksPublishResults archive: true, pmd: true, cpd: true, findbugs: true, checkstyle: true 122 ``` 123 124 ```groovy 125 // publish javascript results from ESLint 126 checksPublishResults archive: true, eslint: [pattern: '**/result-file-with-fancy-name.xml'] 127 ``` 128 129 ```groovy 130 // publish scala results from scalastyle 131 checksPublishResults archive: true, checkstyle: [pattern: '**/target/scalastyle-result.xml'] 132 ``` 133 134 ```groovy 135 // publish python results from pylint 136 checksPublishResults archive: true, pylint: [pattern: '**/target/pylint.log'] 137 ```