Skip to content

Commit

Permalink
fix: Missing link to the scan results in case of hub link present (#494)
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Kopysov <[email protected]>
  • Loading branch information
o-kopysov authored Apr 16, 2024
1 parent 4b6e6d3 commit b397c38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/main/java/com/lpvs/service/LPVSGitHubService.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ public void commentResults(
}
}

StringBuilder commitCommentBuilder = new StringBuilder();
if (conflicts != null && conflicts.size() > 0) {
hasConflicts = true;
StringBuilder commitCommentBuilder = new StringBuilder();
commitCommentBuilder.append("**Detected license conflicts:**\n\n\n");
commitCommentBuilder.append("<ul>");
for (LPVSLicenseService.Conflict<String, String> conflict : conflicts) {
Expand All @@ -326,14 +326,14 @@ public void commentResults(
lpvsDetectedLicenseRepository.saveAndFlush(detectedIssue);
}
commitCommentBuilder.append("</ul>");
if (null != webhookConfig.getHubLink()) {
commitCommentBuilder.append(
"\n\n###### <p align='right'>Check the validation details at the link(");
commitCommentBuilder.append(webhookConfig.getHubLink());
commitCommentBuilder.append(")</p>");
}
commitComment += commitCommentBuilder.toString();
}
if (null != webhookConfig.getHubLink()) {
commitCommentBuilder.append(
"\n\n###### <p align='right'>Check the validation details at the [link](");
commitCommentBuilder.append(webhookConfig.getHubLink());
commitCommentBuilder.append(")</p>");
}
commitComment += commitCommentBuilder.toString();

if (hasProhibitedOrRestricted || hasConflicts) {
lpvsPullRequest.setStatus(LPVSPullRequestStatus.ISSUES_DETECTED.toString());
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/lpvs/service/LPVSGitHubServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,7 @@ class TestCommentResults__ProhibitedPresentConflictsPresent {
+ " */\n\n\n\n\n"
+ "**Detected license conflicts:**\n\n\n"
+ "<ul><li>MIT and Apache-1.0</li></ul>"
+ "\n\n###### <p align='right'>Check the validation details at the link()</p>";
+ "\n\n###### <p align='right'>Check the validation details at the [link]()</p>";

@BeforeEach
void setUp() {
Expand Down Expand Up @@ -2510,7 +2510,7 @@ class TestCommentResults__EmptyPresentConflictsPresent {
+ " */\n\n\n\n\n"
+ "**Detected license conflicts:**\n\n\n"
+ "<ul><li>MIT and Apache-1.0</li></ul>"
+ "\n\n###### <p align='right'>Check the validation details at the link()</p>";
+ "\n\n###### <p align='right'>Check the validation details at the [link]()</p>";

@BeforeEach
void setUp() {
Expand Down Expand Up @@ -2840,7 +2840,7 @@ class TestCommentResults__UnreviewedPresentConflictsPresent {
+ " */\n\n\n\n\n"
+ "**Detected license conflicts:**\n\n\n"
+ "<ul><li>MIT and Apache-1.0</li></ul>"
+ "\n\n###### <p align='right'>Check the validation details at the link()</p>";
+ "\n\n###### <p align='right'>Check the validation details at the [link]()</p>";

@BeforeEach
void setUp() {
Expand Down Expand Up @@ -3172,7 +3172,7 @@ class TestCommentResults__RestrictedPresentConflictsPresent {
+ " */\n\n\n\n\n"
+ "**Detected license conflicts:**\n\n\n"
+ "<ul><li>MIT and Apache-1.0</li></ul>"
+ "\n\n###### <p align='right'>Check the validation details at the link()</p>";
+ "\n\n###### <p align='right'>Check the validation details at the [link]()</p>";

@BeforeEach
void setUp() {
Expand Down

0 comments on commit b397c38

Please sign in to comment.