github.com/jaylevin/jenkins-library@v1.230.4/vars/npmExecuteLint.groovy (about) 1 import com.sap.piper.BuildTool 2 import com.sap.piper.DownloadCacheUtils 3 import groovy.transform.Field 4 import hudson.AbortException 5 6 import static com.sap.piper.Prerequisites.checkScript 7 8 @Field String STEP_NAME = getClass().getName() 9 @Field String METADATA_FILE = 'metadata/npmExecuteLint.yaml' 10 11 //Metadata maintained in file project://resources/metadata/npmExecuteLint.yaml 12 13 void call(Map parameters = [:]) { 14 final script = checkScript(this, parameters) ?: this 15 parameters = DownloadCacheUtils.injectDownloadCacheInParameters(script, parameters, BuildTool.NPM) 16 17 try { 18 piperExecuteBin(parameters, STEP_NAME, METADATA_FILE, []) 19 } catch (Exception exception) { 20 error("Linter execution failed. Please examine the reports which are also available in the Jenkins user interface.") 21 } 22 finally { 23 visualizeLintingResults(script) 24 } 25 } 26 27 private visualizeLintingResults(Script script) { 28 recordIssues blameDisabled: true, 29 enabledForFailure: true, 30 aggregatingResults: false, 31 tool: script.checkStyle(id: "lint", name: "Lint", pattern: "*lint.xml") 32 }