Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing comment on pull request #211

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/java/com/lpvs/service/LPVSGitHubService.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,21 +252,26 @@ public void commentResults(LPVSQueue webhookConfig, List<LPVSFile> scanResults,
lpvsDetectedLicenseRepository.saveAndFlush(detectedIssue);
}
commitCommentBuilder.append("</ul>");
if (null != webhookConfig.getHubLink()) {
commitCommentBuilder.append("(");
commitCommentBuilder.append(webhookConfig.getHubLink());
commitCommentBuilder.append(")");
}
Comment on lines +255 to +259
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about removing hubLink in LPVSQueue? I don't think that LPVS set and use the value.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer to keep this field in the table because it is used in the internal version of LPVS, and we want to use open source version internally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. You're absolutely right; we're not using it right now. However, after discussing it internally, we've decided to keep it as an option in case we need it in the future.

commitComment += commitCommentBuilder.toString();
}

if (hasProhibitedOrRestricted || hasConflicts) {
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() + ")</p>");
commitComment + "</p>");
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() + ")</p>");
commitComment + "</p>");
repository.createCommitStatus(webhookConfig.getHeadCommitSHA(), GHCommitState.SUCCESS, null,
"No license issue detected", "[License Pre-Validation Service]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public List<LPVSFile> checkLicenses(LPVSQueue webhookConfig) {
.replaceAll("],", "\"],")
.replaceAll("\"\\{\"","{\"")
.replaceAll("\"}\"]", "\"}]")
.replaceAll("\\[\"\"\\]", "[]")
.replaceAll("incompatible_with\" : (\".*?\"), \"name", "incompatible_with\" : \\[$1\\], \"name")
;
content = content.substring(1, content.length() - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)</p>";
"</p>";

@BeforeEach
void setUp() {
Expand Down
Loading