diff --git a/.groovylintrc.json b/.groovylintrc.json index afd953e..1b0301d 100644 --- a/.groovylintrc.json +++ b/.groovylintrc.json @@ -18,6 +18,9 @@ }, "NoDef": { "enabled": false + }, + "UnnecessaryGetter": { + "enabled": false } } } \ No newline at end of file diff --git a/vars/findVersionFromNexusRepo.groovy b/vars/findVersionFromNexusRepo.groovy index aeb4d39..5198345 100644 --- a/vars/findVersionFromNexusRepo.groovy +++ b/vars/findVersionFromNexusRepo.groovy @@ -38,7 +38,7 @@ Map call(Map config = [:], Map queryParams = [:]) { body = response.content assets = readJSON text: body - if (assets.items && !assets.items.empty) { + if (assets.items && !assets.items.isEmpty()) { latest = assets.items.last() /* We have to use instanceof here. The value SHOULD be null, but it comes back as class rather than null. This is probably a bug in the Pipeline Utilities @@ -46,7 +46,7 @@ Map call(Map config = [:], Map queryParams = [:]) { /* groovylint-disable-next-line Instanceof */ if (latest.version instanceof net.sf.json.JSONNull && latest.name) { echo 'Search result version field was null, looking in name field for a version' - match = (latest.name =~ /(?<=-)(\d+\.\d+\.\d+)(?=[\.-].*)/) + java.util.regex.Matcher match = (latest.name =~ /(?<=-)(\d+\.\d+\.\d+)(?=[\.-].*)/) if (!match) { echo "Match: ${match}" error("Regular expression match failed for latest.name: ${latest.name}")