diff --git a/src/main/java/com/lpvs/service/LPVSGitHubService.java b/src/main/java/com/lpvs/service/LPVSGitHubService.java index 4848c68b..5e431f6a 100644 --- a/src/main/java/com/lpvs/service/LPVSGitHubService.java +++ b/src/main/java/com/lpvs/service/LPVSGitHubService.java @@ -252,6 +252,11 @@ public void commentResults(LPVSQueue webhookConfig, List scanResults, lpvsDetectedLicenseRepository.saveAndFlush(detectedIssue); } commitCommentBuilder.append(""); + if (null != webhookConfig.getHubLink()) { + commitCommentBuilder.append("("); + commitCommentBuilder.append(webhookConfig.getHubLink()); + commitCommentBuilder.append(")"); + } commitComment += commitCommentBuilder.toString(); } @@ -259,14 +264,14 @@ public void commentResults(LPVSQueue webhookConfig, List scanResults, lpvsPullRequest.setStatus(LPVSPullRequestStatus.ISSUES_DETECTED.toString()); pullRequestRepository.save(lpvsPullRequest); pullRequest.comment("**\\[License Pre-Validation Service\\]** Potential license problem(s) detected \n\n" + - commitComment + "(" + webhookConfig.getHubLink() + ")

"); + commitComment + "

"); repository.createCommitStatus(webhookConfig.getHeadCommitSHA(), GHCommitState.FAILURE, null, "Potential license problem(s) detected", "[License Pre-Validation Service]"); } else { lpvsPullRequest.setStatus(LPVSPullRequestStatus.COMPLETED.toString()); pullRequestRepository.save(lpvsPullRequest); pullRequest.comment("**\\[License Pre-Validation Service\\]** No license issue detected \n\n" + - commitComment + "(" + webhookConfig.getHubLink() + ")

"); + commitComment + "

"); repository.createCommitStatus(webhookConfig.getHeadCommitSHA(), GHCommitState.SUCCESS, null, "No license issue detected", "[License Pre-Validation Service]"); } diff --git a/src/main/java/com/lpvs/service/scanner/scanoss/LPVSScanossDetectService.java b/src/main/java/com/lpvs/service/scanner/scanoss/LPVSScanossDetectService.java index f63f9994..e574cbc7 100644 --- a/src/main/java/com/lpvs/service/scanner/scanoss/LPVSScanossDetectService.java +++ b/src/main/java/com/lpvs/service/scanner/scanoss/LPVSScanossDetectService.java @@ -132,6 +132,7 @@ public List checkLicenses(LPVSQueue webhookConfig) { .replaceAll("],", "\"],") .replaceAll("\"\\{\"","{\"") .replaceAll("\"}\"]", "\"}]") + .replaceAll("\\[\"\"\\]", "[]") .replaceAll("incompatible_with\" : (\".*?\"), \"name", "incompatible_with\" : \\[$1\\], \"name") ; content = content.substring(1, content.length() - 1); diff --git a/src/test/java/com/lpvs/service/LPVSGitHubServiceTest.java b/src/test/java/com/lpvs/service/LPVSGitHubServiceTest.java index a9bef5ff..a21e0e09 100644 --- a/src/test/java/com/lpvs/service/LPVSGitHubServiceTest.java +++ b/src/test/java/com/lpvs/service/LPVSGitHubServiceTest.java @@ -1646,7 +1646,7 @@ class TestCommentResults__ProhibitedAbsentConflictsAbsent { " * Use of this source code is governed by a MIT license that can be\n" + " * found in the LICENSE file.\n" + " */\n\n\n\n\n" + - "(null)

"; + "

"; @BeforeEach void setUp() {