-
-
Notifications
You must be signed in to change notification settings - Fork 534
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 problem with unprocessed Pull Requests in SonarQube #796
Conversation
- Avoid unprocessed new Pull Requests for listing in projects - Add test for that use case
@mc1arke will this be in release 1.15.0? |
@@ -177,6 +177,92 @@ void shouldExecuteRequestWithValidParameter() { | |||
assertThat(messageArgumentCaptor.getValue()).usingRecursiveComparison().isEqualTo(expected); | |||
} | |||
|
|||
@Test | |||
void shouldExExcludePullRequestsWithoutData() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo? ExEc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I will refactor it.
@@ -115,12 +115,15 @@ private static void checkPermission(ProjectDto project, UserSession userSession) | |||
|
|||
private static void addPullRequest(ProjectPullRequests.ListWsResponse.Builder response, BranchDto branch, Map<String, BranchDto> mergeBranchesByUuid, | |||
@Nullable LiveMeasureDto qualityGateMeasure, @Nullable String analysisDate) { | |||
DbProjectBranches.PullRequestData pullRequestData = branch.getPullRequestData(); | |||
|
|||
if (pullRequestData == null) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use curly braces on all if
statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I will add them in the new changes.
I'm superceding this with #847 since the Pull Request data fields are not mandatory and I'd rather we didn't end up with data in the database that wasn't visible in the API, as users then don't know if they've got potentially broken data needing cleaned-up. I've also put in a fix for the root cause of the problem reported in the original issue which should mean the data is less likely to get corrupt. Thanks for the contribution though! |
Awesome! Thank you so much and keep the good work! 😄 |
Related to the issue #738, it's true that any type of project should not be created with a Pull Request that their target branch is not scanned yet.
But the problem comes when the Pull Request, which its target branch is scanned, is waiting for being processed when there's a heavy project in progress status in the Background tasks section. Because SonarQube didn't add the proper Pull Request data to the project until is processed, we have the same problem as was described in the issue mentioned before, even when we have the target branch scan.
So the changes that are added in this Pull Request are simple:
If there's any doubt, please, use this Pull Request for the discussion.