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

[GITHUB] Add support for multiple pull request decoration - mono repo support #213

Merged
merged 1 commit into from
Jul 26, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ public String getAnalysisProjectKey() {
return project.getKey();
}

public String getAnalysisProjectName() {
return project.getName();
}

public List<QualityGate.Condition> findFailedConditions() {
return qualityGate.getConditions().stream().filter(c -> c.getStatus() == QualityGate.EvaluationStatus.ERROR)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public DecorationResult createCheckRun(AnalysisDetails analysisDetails, AlmSetti

Map<String, Object> inputObjectArguments = new HashMap<>();
inputObjectArguments.put("repositoryId", repositoryAuthenticationToken.getRepositoryId());
inputObjectArguments.put("name", "Sonarqube Results");
inputObjectArguments.put("name", String.format("%s Sonarqube Results", analysisDetails.getAnalysisProjectName()));
inputObjectArguments.put("status", RequestableCheckStatusState.COMPLETED);
inputObjectArguments.put("conclusion", QualityGate.Status.OK == analysisDetails.getQualityGateStatus() ?
CheckConclusionState.SUCCESS : CheckConclusionState.FAILURE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ private void createCheckRunHappyPath(QualityGate.Status status, String basePath,
when(analysisDetails.createAnalysisSummary(any())).thenReturn("dummy summary");
when(analysisDetails.getCommitSha()).thenReturn("commit SHA");
when(analysisDetails.getAnalysisProjectKey()).thenReturn("projectKey");
when(analysisDetails.getAnalysisProjectName()).thenReturn("projectName");
when(analysisDetails.getBranchName()).thenReturn("branchName");
when(analysisDetails.getAnalysisDate()).thenReturn(new Date(1234567890));
when(analysisDetails.getAnalysisId()).thenReturn("analysis ID");
Expand Down Expand Up @@ -486,7 +487,7 @@ private void createCheckRunHappyPath(QualityGate.Status status, String basePath,
assertThat(annotationArgumentCaptor.getValue()).isEqualTo(expectedAnnotationObjects);

verify(inputObjectBuilders.get(position + 1)).put(eq("repositoryId"), eq("repository ID"));
verify(inputObjectBuilders.get(position + 1)).put(eq("name"), eq("Sonarqube Results"));
verify(inputObjectBuilders.get(position + 1)).put(eq("name"), eq("projectName Sonarqube Results"));
verify(inputObjectBuilders.get(position + 1)).put(eq("headSha"), eq("commit SHA"));
verify(inputObjectBuilders.get(position + 1)).put(eq("status"), eq(RequestableCheckStatusState.COMPLETED));
verify(inputObjectBuilders.get(position + 1)).put(eq("conclusion"), eq(status == QualityGate.Status.OK ?
Expand Down