From 7f1ad13627b2ce5977b3d5252ca3369fa5d76d05 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Tue, 23 Jul 2024 09:42:48 -0400 Subject: [PATCH] Reconnect Sonar --- .github/workflows/gradle.yml | 10 +++++----- .../com/bioraft/rundeck/nexus/BranchOrVersion.java | 8 ++++---- .../com/bioraft/rundeck/nexus/BranchOrVersionTest.java | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 0fc2b4d..7192b4f 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -17,10 +17,10 @@ jobs: run: ./gradlew test - name: Determine coverage run: ./gradlew jacocoTestReport -# - name: Scan with Sonar -# run: ./gradlew sonar -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Scan with Sonar + run: ./gradlew sonar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Build with Gradle run: ./gradlew build diff --git a/src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java b/src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java index 48ac3cf..86c37fe 100644 --- a/src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java +++ b/src/main/java/com/bioraft/rundeck/nexus/BranchOrVersion.java @@ -73,10 +73,10 @@ public BranchOrVersion(String path) { artifactId = component(path); componentVersion = tag(path); String sep; - if (componentVersion.matches("^.+" + BUILD_SEPARATOR_REGEX + "[a-zA-Z0-9_-]+$")) { - build = componentVersion.replaceFirst("^.+" + BUILD_SEPARATOR_REGEX + "([a-zA-Z0-9_-]+)$", "$1"); - versionOrBranch = componentVersion.replaceFirst("^(.+)" + BUILD_SEPARATOR_REGEX + build + "$", "$1"); - sep = componentVersion.replaceFirst("^.+(" + BUILD_SEPARATOR_REGEX + ")" + build + "$", "$1"); + if (componentVersion.matches("^.+" + BUILD_SEPARATOR_REGEX + "[a-zA-Z0-9]+$")) { + versionOrBranch = componentVersion.replaceFirst("^(.+)" + BUILD_SEPARATOR_REGEX + "[a-zA-Z0-9]+$", "$1"); + build = componentVersion.replaceFirst("^" + versionOrBranch + BUILD_SEPARATOR_REGEX + "([a-zA-Z0-9]+)$", "$1"); + sep = componentVersion.replaceFirst("^" + versionOrBranch + "(" + BUILD_SEPARATOR_REGEX + ")" + build + "$", "$1"); } else { build = ""; versionOrBranch = componentVersion; diff --git a/src/test/java/com/bioraft/rundeck/nexus/BranchOrVersionTest.java b/src/test/java/com/bioraft/rundeck/nexus/BranchOrVersionTest.java index eb61e3f..9cb436f 100644 --- a/src/test/java/com/bioraft/rundeck/nexus/BranchOrVersionTest.java +++ b/src/test/java/com/bioraft/rundeck/nexus/BranchOrVersionTest.java @@ -37,9 +37,9 @@ public void testOne() { runTest(COMPONENT, "0.1.2", "_", "3"); runTest(COMPONENT, "1.2.1.2", "-", "4"); runTest(COMPONENT, "v1.2.1.5", "-", "6"); - runTest(COMPONENT, "v2.2.1.", "_", "16"); - runTest(COMPONENT, "v2.2.0.", "_", "beta6"); - runTest(COMPONENT, "v2.2.0.", "+", "alpha1"); + runTest(COMPONENT, "v2.2.1", "_", "16"); + runTest(COMPONENT, "v2.2.0", "_", "beta6"); + runTest(COMPONENT, "v2.2.0", "+", "alpha1"); runTest(COMPONENT, "", "", ""); }