aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-scanner-engine/src/main/java')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java1
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java5
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java9
3 files changed, 2 insertions, 13 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java
index f04cbf78ab0..4b9d463a164 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java
@@ -73,7 +73,6 @@ public class ChangedLinesPublisher implements ReportPublisherStep {
}
private int writeChangedLines(ScmProvider provider, ScannerReportWriter writer, String targetScmBranch) {
-
Path rootBaseDir = inputModuleHierarchy.root().getBaseDir();
Map<Path, DefaultInputFile> changedFiles = StreamSupport.stream(inputComponentStore.allChangedFilesToPublish().spliterator(), false)
.collect(Collectors.toMap(DefaultInputFile::path, f -> f));
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