diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-01-09 14:16:56 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-01-09 20:21:08 +0100 |
commit | 8d3f4bd7495ee6aa204f31c7329ffffedc7e5ae7 (patch) | |
tree | 40be64f44ca6ab72f20676aa4683d10276b9618b /sonar-scanner-engine/src/main/java/org/sonar/scanner/scan | |
parent | db9ccd217314f45a612028ffcf64daff0169f370 (diff) | |
download | sonarqube-8d3f4bd7495ee6aa204f31c7329ffffedc7e5ae7.tar.gz sonarqube-8d3f4bd7495ee6aa204f31c7329ffffedc7e5ae7.zip |
SONAR-11605 No changed lines detected in P/R and SLB if target branch is not explicitly specified
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/scan')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java | 5 | ||||
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java | 9 |
2 files changed, 2 insertions, 12 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java index 05aa97c274f..4398c3dc3a8 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java @@ -23,7 +23,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.CheckForNull; -import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; /** @@ -31,10 +30,7 @@ import javax.annotation.concurrent.Immutable; */ @Immutable public class ProjectBranches { - private final Map<String, BranchInfo> branches; - - @Nullable private final String defaultBranchName; public ProjectBranches(List<BranchInfo> branchInfos) { @@ -59,7 +55,6 @@ public class ProjectBranches { return branches.isEmpty(); } - @CheckForNull public String defaultBranchName() { return defaultBranchName; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java index 9c3feab2c22..93132a99b65 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java @@ -32,16 +32,11 @@ import javax.annotation.concurrent.Immutable; */ @Immutable public class ProjectPullRequests { - + private static final BinaryOperator<PullRequestInfo> PICK_MOST_RECENT_ANALYSIS = (a, b) -> a.getAnalysisDate() < b.getAnalysisDate() ? b : a; private final Map<String, PullRequestInfo> pullRequestsByBranchName; public ProjectPullRequests(List<PullRequestInfo> pullRequestInfos) { - BinaryOperator<PullRequestInfo> mergeFunction = pickMostRecentAnalysis(); - this.pullRequestsByBranchName = pullRequestInfos.stream().collect(Collectors.toMap(PullRequestInfo::getBranch, Function.identity(), mergeFunction)); - } - - private static BinaryOperator<PullRequestInfo> pickMostRecentAnalysis() { - return (a, b) -> a.getAnalysisDate() < b.getAnalysisDate() ? b : a; + this.pullRequestsByBranchName = pullRequestInfos.stream().collect(Collectors.toMap(PullRequestInfo::getBranch, Function.identity(), PICK_MOST_RECENT_ANALYSIS)); } @CheckForNull |