diff options
Diffstat (limited to 'server')
109 files changed, 52 insertions, 185 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/Branch.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/Branch.java index 66b2e175f31..052e479d89e 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/Branch.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/Branch.java @@ -54,11 +54,11 @@ public interface Branch extends ComponentKeyGenerator { String getPullRequestKey(); /** - * The target/base branch name of a SLB or PR. + * The target/base branch name of a PR. * Correspond to <pre>sonar.pullrequest.base</pre> or <pre>sonar.branch.target</pre> * It's not guaranteed to exist. * - * @throws IllegalStateException if this branch configuration is not a pull request or SLB. + * @throws IllegalStateException if this branch configuration is not a pull request. */ String getTargetBranchName(); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/Component.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/Component.java index a3c171f39b2..352e07efa32 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/Component.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/Component.java @@ -59,8 +59,8 @@ public interface Component { } /** - * On a long-living branch, CHANGED and ADDED are relative to the previous analysis. - * On a short-living branch and pull request, these are relative to the base branch. + * On a branch, CHANGED and ADDED are relative to the previous analysis. + * On a pull request, these are relative to the base branch. */ enum Status { UNAVAILABLE, SAME, CHANGED, ADDED diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ConfigurationRepositoryImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ConfigurationRepositoryImpl.java index 6a798621077..8677927e59c 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ConfigurationRepositoryImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ConfigurationRepositoryImpl.java @@ -24,8 +24,6 @@ import com.google.common.base.Suppliers; import org.sonar.api.config.Configuration; import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.analysis.ProjectConfigurationFactory; -import org.sonar.ce.task.projectanalysis.analysis.ProjectConfigurationFactory; -import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; /** * Repository of component settings implementation based on a memory cache. diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DefaultBranchImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DefaultBranchImpl.java index a42889a088b..938740db97b 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DefaultBranchImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/DefaultBranchImpl.java @@ -71,7 +71,7 @@ public class DefaultBranchImpl implements Branch { @Override public String getTargetBranchName() { - throw new IllegalStateException("Only on a short lived branch or pull request"); + throw new IllegalStateException("Only on a pull request"); } @Override diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolder.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolder.java index 14763baa2d0..49bb568f131 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolder.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/TreeRootHolder.java @@ -34,7 +34,7 @@ public interface TreeRootHolder { * The root of the tree, for example the project or the portfolio. * With branches, it will refer to the root component of the branch. * - * On a short living branch or pull request, it contains ONLY: + * On a pull request, it contains ONLY: * 1. The PROJECT component (tree root) * 2. The FILE components whose status is not SAME * 3. Intermediary MODULE and DIRECTORY components that lead to FILE leafs that are not SAME @@ -47,7 +47,7 @@ public interface TreeRootHolder { * The root of the components that were in the scanner report. * This tree may include components that are not persisted, * just kept in memory for computation purposes, such as overall coverage - * in short living branches or pull requests. + * in pull requests. * * @throws IllegalStateException if the holder is empty (ie. there is no root yet) */ diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationMeasures.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationMeasures.java index 08200f35b0e..fc2a51f9c62 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationMeasures.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationMeasures.java @@ -111,7 +111,7 @@ public class DuplicationMeasures { } protected void initializeForFile(Component file) { - // don't use measure since it won't be available for some files in the report tree in SLB + // don't use measure since it won't be available for some files in the report tree in PRs this.lineCount = file.getFileAttributes().getLines(); Iterable<Duplication> duplications = requireNonNull(this.duplicationRepository, "DuplicationRepository missing") .getDuplications(file); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationRepository.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationRepository.java index 77a1f877373..4c028f3e114 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationRepository.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationRepository.java @@ -20,7 +20,6 @@ package org.sonar.ce.task.projectanalysis.duplication; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; /** * Repository of code duplications in files of the project. diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/InProjectDuplicate.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/InProjectDuplicate.java index 57b16238774..18211dc777c 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/InProjectDuplicate.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/duplication/InProjectDuplicate.java @@ -23,7 +23,6 @@ import java.util.Objects; import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/event/EventRepository.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/event/EventRepository.java index 352c44fdc7d..37c886e81c5 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/event/EventRepository.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/event/EventRepository.java @@ -20,9 +20,6 @@ package org.sonar.ce.task.projectanalysis.event; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; - -import static org.sonar.ce.task.projectanalysis.component.Component.Type; public interface EventRepository { /** diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/event/EventRepositoryImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/event/EventRepositoryImpl.java index a3a403c7cdf..a4c595f9038 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/event/EventRepositoryImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/event/EventRepositoryImpl.java @@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.event; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/MovedFilesRepository.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/MovedFilesRepository.java index b45958e3a0c..1894de4cc3a 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/MovedFilesRepository.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/MovedFilesRepository.java @@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.filemove; import com.google.common.base.Optional; import javax.annotation.Nullable; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; import static java.util.Objects.requireNonNull; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/MutableMovedFilesRepository.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/MutableMovedFilesRepository.java index bdb7391b5a9..b70faed8385 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/MutableMovedFilesRepository.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/MutableMovedFilesRepository.java @@ -20,9 +20,6 @@ package org.sonar.ce.task.projectanalysis.filemove; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; - -import static org.sonar.ce.task.projectanalysis.component.Component.Type; public interface MutableMovedFilesRepository extends MovedFilesRepository { /** diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/Counter.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/Counter.java index aad6d74dded..a81b35b2dcb 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/Counter.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/Counter.java @@ -21,8 +21,6 @@ package org.sonar.ce.task.projectanalysis.formula; import org.sonar.ce.task.projectanalysis.component.Component; -import static org.sonar.ce.task.projectanalysis.component.Component.Type; - /** * A counter is used to aggregate some data */ diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/coverage/ElementsAndCoveredElementsCounter.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/coverage/ElementsAndCoveredElementsCounter.java index c73e40aebb0..9b18ebfa80a 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/coverage/ElementsAndCoveredElementsCounter.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/coverage/ElementsAndCoveredElementsCounter.java @@ -20,7 +20,6 @@ package org.sonar.ce.task.projectanalysis.formula.coverage; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.formula.Counter; import org.sonar.ce.task.projectanalysis.formula.CounterInitializationContext; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/coverage/ElementsAndCoveredElementsVariationCounter.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/coverage/ElementsAndCoveredElementsVariationCounter.java index 2b6dedd4369..083b006fe37 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/coverage/ElementsAndCoveredElementsVariationCounter.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/formula/coverage/ElementsAndCoveredElementsVariationCounter.java @@ -23,10 +23,6 @@ import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.formula.Counter; import org.sonar.ce.task.projectanalysis.formula.CounterInitializationContext; import org.sonar.ce.task.projectanalysis.formula.counter.LongValue; -import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.formula.Counter; -import org.sonar.ce.task.projectanalysis.formula.CounterInitializationContext; -import org.sonar.ce.task.projectanalysis.formula.counter.LongValue; /** * A counter used to create measure variations which are based on a count of elements and coveredElements. diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesRepository.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesRepository.java index 802b5efbf0a..e46ddc3a7fd 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesRepository.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesRepository.java @@ -23,7 +23,6 @@ import java.util.List; import org.sonar.api.ce.measure.MeasureComputer; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.core.issue.DefaultIssue; -import org.sonar.ce.task.projectanalysis.component.Component; /** * This repository contains issues for only one component at a time. It's populated by {@link IntegrateIssuesVisitor} and diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/DefaultAssignee.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/DefaultAssignee.java index 2cf38810965..ffccb31d94f 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/DefaultAssignee.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/DefaultAssignee.java @@ -22,12 +22,11 @@ package org.sonar.ce.task.projectanalysis.issue; import javax.annotation.CheckForNull; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; +import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; import org.sonar.ce.task.projectanalysis.component.ConfigurationRepository; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.UserDto; -import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder; -import org.sonar.ce.task.projectanalysis.component.ConfigurationRepository; import static com.google.common.base.Strings.isNullOrEmpty; import static org.sonar.api.CoreProperties.DEFAULT_ISSUE_ASSIGNEE; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/DefaultTrackingInput.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/DefaultTrackingInput.java index ec5d0019b5d..9d15dd4b2c0 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/DefaultTrackingInput.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/DefaultTrackingInput.java @@ -20,7 +20,6 @@ package org.sonar.ce.task.projectanalysis.issue; import java.util.Collection; - import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.tracking.BlockHashSequence; import org.sonar.core.issue.tracking.Input; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueVisitors.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueVisitors.java index 111971fea9a..f547dc3833c 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueVisitors.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueVisitors.java @@ -21,7 +21,6 @@ package org.sonar.ce.task.projectanalysis.issue; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.core.issue.DefaultIssue; -import org.sonar.ce.task.projectanalysis.component.Component; public class IssueVisitors { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitor.java index 5f544b72235..0c3d0cce165 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitor.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitor.java @@ -21,7 +21,6 @@ package org.sonar.ce.task.projectanalysis.issue; import java.util.ArrayList; import java.util.List; - import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.core.issue.DefaultIssue; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/MutableComponentIssuesRepository.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/MutableComponentIssuesRepository.java index 1fdcce6c956..1507535d168 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/MutableComponentIssuesRepository.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/MutableComponentIssuesRepository.java @@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.issue; import java.util.List; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.core.issue.DefaultIssue; -import org.sonar.ce.task.projectanalysis.component.Component; public interface MutableComponentIssuesRepository extends ComponentIssuesRepository { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java index e7ea5eeab70..1ca6d1b7cf2 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecution.java @@ -53,7 +53,7 @@ public class PullRequestTrackerExecution { Input<DefaultIssue> rawInput = rawInputFactory.create(component); Input<DefaultIssue> previousAnalysisInput = baseInputFactory.create(component); - // Step 1: track issues with merge branch (= long living) + // Step 1: track issues with merge branch Input<DefaultIssue> unmatchedRawsAfterMergeBranchTracking; if (mergeInputFactory.hasMergeBranchAnalysis()) { Input<DefaultIssue> mergeInput = mergeInputFactory.createForMergeBranch(component); @@ -84,7 +84,7 @@ public class PullRequestTrackerExecution { unmatchedRawsAfterChangedLineFiltering = unmatchedRawsAfterTargetBranchTracking; } - // Step 4: track issues of previous analysis of the current branch/PR + // Step 4: track issues of previous analysis of the current PR return tracker.trackNonClosed(unmatchedRawsAfterChangedLineFiltering, previousAnalysisInput); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/RemoveProcessedComponentsVisitor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/RemoveProcessedComponentsVisitor.java index 63ae6cd23e6..9932989aed8 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/RemoveProcessedComponentsVisitor.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/RemoveProcessedComponentsVisitor.java @@ -19,12 +19,10 @@ */ package org.sonar.ce.task.projectanalysis.issue; -import org.sonar.ce.task.projectanalysis.component.Component; +import com.google.common.base.Optional; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.filemove.MovedFilesRepository; -import com.google.common.base.Optional; - public class RemoveProcessedComponentsVisitor extends IssueVisitor { private final ComponentsWithUnprocessedIssues componentsWithUnprocessedIssues; private final MovedFilesRepository movedFilesRepository; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/RuleTagsCopier.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/RuleTagsCopier.java index b8a8a47e1be..dc8008c7908 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/RuleTagsCopier.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/RuleTagsCopier.java @@ -21,7 +21,6 @@ package org.sonar.ce.task.projectanalysis.issue; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.core.issue.DefaultIssue; -import org.sonar.ce.task.projectanalysis.component.Component; import static com.google.common.collect.Sets.union; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java index 11ce82356e4..890a343f935 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssuesLoader.java @@ -32,7 +32,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; import org.sonar.db.issue.IssueDto; -import org.sonar.db.issue.ShortBranchIssueDto; +import org.sonar.db.issue.PrIssueDto; import static org.sonar.api.utils.DateUtils.longToDate; import static org.sonar.core.util.stream.MoreCollectors.toList; @@ -66,7 +66,7 @@ public class SiblingsIssuesLoader { } } - private static SiblingIssue toSiblingIssue(ShortBranchIssueDto dto) { + private static SiblingIssue toSiblingIssue(PrIssueDto dto) { return new SiblingIssue(dto.getKey(), dto.getLine(), dto.getMessage(), dto.getChecksum(), dto.getRuleKey(), dto.getStatus(), dto.getBranchKey(), dto.getKeyType(), longToDate(dto.getIssueUpdateDate())); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngine.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngine.java index 10826dcef1c..89938c01693 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngine.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngine.java @@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.issue.commonrule; import java.util.Collection; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.core.issue.DefaultIssue; -import org.sonar.ce.task.projectanalysis.component.Component; /** * Generate the issues related to "common rules", which are diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngineImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngineImpl.java index 2f69ed772a9..b9168e6336c 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngineImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/commonrule/CommonRuleEngineImpl.java @@ -24,7 +24,6 @@ import java.util.Collection; import javax.annotation.CheckForNull; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.core.issue.DefaultIssue; -import org.sonar.ce.task.projectanalysis.component.Component; public class CommonRuleEngineImpl implements CommonRuleEngine { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolder.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolder.java index 42e572bdc5b..b054a097318 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolder.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolder.java @@ -20,7 +20,6 @@ package org.sonar.ce.task.projectanalysis.measure; import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper; -import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper; public interface MeasureComputersHolder { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java index f58db2cb374..2119534d5b6 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureComputersHolderImpl.java @@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.measure; import com.google.common.base.Predicates; import javax.annotation.CheckForNull; import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper; -import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper; import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.FluentIterable.from; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MutableMeasureComputersHolder.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MutableMeasureComputersHolder.java index ccddc87b6df..0d7483bc11e 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MutableMeasureComputersHolder.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MutableMeasureComputersHolder.java @@ -20,7 +20,6 @@ package org.sonar.ce.task.projectanalysis.measure; import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper; -import org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper; /** * A {@link MeasureComputersHolder} which value can be set only once. diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/EvaluatedCondition.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/EvaluatedCondition.java index f802af4fd54..db9febd9020 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/EvaluatedCondition.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/qualitygatedetails/EvaluatedCondition.java @@ -23,8 +23,6 @@ import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; import org.sonar.ce.task.projectanalysis.measure.Measure; import org.sonar.ce.task.projectanalysis.qualitygate.Condition; -import org.sonar.ce.task.projectanalysis.measure.Measure; -import org.sonar.ce.task.projectanalysis.qualitygate.Condition; import static java.util.Objects.requireNonNull; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/SecurityReviewRatingVisitor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/SecurityReviewRatingVisitor.java index 866b8ac4a01..3603883a80d 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/SecurityReviewRatingVisitor.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/qualitymodel/SecurityReviewRatingVisitor.java @@ -37,7 +37,6 @@ import static org.sonar.api.measures.CoreMetrics.SECURITY_HOTSPOTS_KEY; import static org.sonar.api.measures.CoreMetrics.SECURITY_REVIEW_RATING_KEY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT; import static org.sonar.ce.task.projectanalysis.component.Component.Type.SUBVIEW; -import static org.sonar.ce.task.projectanalysis.measure.Measure.newMeasureBuilder; public class SecurityReviewRatingVisitor extends TypeAwareVisitorAdapter { diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoader.java index 07dc89a4c56..8f1be4b8775 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoader.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoader.java @@ -64,7 +64,7 @@ public class ScmInfoDbLoader { return Optional.of(file.getUuid()); } - // at this point, it's the first analysis of a LLB with copyFromPrevious flag true or any analysis of a PR/SLB + // at this point, it's the first analysis of a branch with copyFromPrevious flag true or any analysis of a PR Branch branch = analysisMetadataHolder.getBranch(); if (!branch.isMain()) { String uuid = mergeBranchComponentUuid.getTargetBranchComponentUuid(file.getDbKey()); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/DbLineHashVersion.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/DbLineHashVersion.java index f139d37e3d6..98a8fb0083c 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/DbLineHashVersion.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/DbLineHashVersion.java @@ -25,7 +25,6 @@ import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.source.LineHashVersion; -import org.sonar.ce.task.projectanalysis.component.Component; public class DbLineHashVersion { private final Map<Component, LineHashVersion> lineHashVersionPerComponent = new HashMap<>(); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/NewLinesRepository.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/NewLinesRepository.java index 313fbe3a41a..41cd5eea101 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/NewLinesRepository.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/NewLinesRepository.java @@ -61,7 +61,7 @@ public class NewLinesRepository { } /** - * If the changed lines are not in the report or if we are not analyzing a short lived branch (or P/R) we fall back to this method. + * If the changed lines are not in the report or if we are not analyzing a P/R we fall back to this method. * If there is a period and SCM information, we compare the change dates of each line with the start of the period to figure out * if a line is new or not. */ diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashCache.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashCache.java index 02d021b2dd6..8fc48620ad1 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashCache.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashCache.java @@ -30,7 +30,6 @@ import java.util.Set; import java.util.function.Function; import org.sonar.api.utils.TempFolder; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; public class SourceLinesHashCache { private static final String FILE_NAME_PREFIX = "hashes-"; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepository.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepository.java index 290c7cebebf..717b6912564 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepository.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepository.java @@ -21,8 +21,6 @@ package org.sonar.ce.task.projectanalysis.source; import java.util.List; import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.component.Component; -import org.sonar.ce.task.projectanalysis.source.SourceLinesHashRepositoryImpl.LineHashesComputer; /** * Generates line hashes from source code included in the report. diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/SymbolsLineReader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/SymbolsLineReader.java index 5f71ea42462..495f995e3a6 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/SymbolsLineReader.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/linereader/SymbolsLineReader.java @@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.source.linereader; import com.google.common.collect.HashMultimap; import com.google.common.collect.Lists; import com.google.common.collect.SetMultimap; -import java.util.ArrayList; import java.util.Comparator; import java.util.IdentityHashMap; import java.util.Iterator; diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java index cf84c305e97..6ebaba9c874 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityGateStep.java @@ -55,13 +55,13 @@ public class LoadQualityGateStep implements ComputationStep { } if (analysisMetadataHolder.isPullRequest()) { - qualityGate = filterQGForSLB(qualityGate); + qualityGate = filterQGForPR(qualityGate); } qualityGateHolder.setQualityGate(qualityGate.orElseThrow(() -> new IllegalStateException("Quality gate not present"))); } - private static Optional<QualityGate> filterQGForSLB(Optional<QualityGate> qualityGate) { + private static Optional<QualityGate> filterQGForPR(Optional<QualityGate> qualityGate) { return qualityGate.map(qg -> new QualityGate(qg.getId(), qg.getName(), qg.getConditions().stream().filter(Condition::useVariation).collect(Collectors.toList()))); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityProfilesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityProfilesStep.java index 7c2a7430009..261282f0f73 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityProfilesStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadQualityProfilesStep.java @@ -35,8 +35,6 @@ import org.sonar.ce.task.step.ComputationStep; import org.sonar.core.util.CloseableIterator; import org.sonar.scanner.protocol.output.ScannerReport; -import static com.google.common.base.Strings.emptyToNull; - public class LoadQualityProfilesStep implements ComputationStep { private final BatchReportReader batchReportReader; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/ComponentImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/ComponentImplTest.java index d0f4c51e5b0..e1cfa4394f4 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/ComponentImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/ComponentImplTest.java @@ -21,7 +21,6 @@ package org.sonar.ce.task.projectanalysis.component; import java.util.Arrays; import java.util.Collections; -import org.apache.commons.lang.RandomStringUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationMeasuresTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationMeasuresTest.java index 6c11486f4e6..cf5b57ac712 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationMeasuresTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/duplication/DuplicationMeasuresTest.java @@ -43,7 +43,6 @@ import static org.sonar.ce.task.projectanalysis.component.Component.Type.DIRECTO import static org.sonar.ce.task.projectanalysis.component.Component.Type.FILE; import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT; import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builder; -import static org.sonar.ce.task.projectanalysis.measure.Measure.newMeasureBuilder; public class DuplicationMeasuresTest { private static final int ROOT_REF = 1; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/duplication/ViewsDuplicationMeasuresTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/duplication/ViewsDuplicationMeasuresTest.java index 8ee2a332b23..8ab57d517d2 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/duplication/ViewsDuplicationMeasuresTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/duplication/ViewsDuplicationMeasuresTest.java @@ -26,7 +26,6 @@ import org.sonar.ce.task.projectanalysis.measure.MeasureRepositoryRule; import org.sonar.ce.task.projectanalysis.metric.MetricRepositoryRule; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES_KEY; import static org.sonar.api.measures.CoreMetrics.DUPLICATED_BLOCKS; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java index 1e3936ededa..c5b14a98b1b 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java @@ -33,7 +33,6 @@ import org.sonar.ce.task.projectanalysis.metric.MetricRepositoryRule; import org.sonar.ce.task.projectanalysis.period.PeriodHolderRule; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.COMPLEXITY_IN_FUNCTIONS_KEY; import static org.sonar.api.measures.CoreMetrics.FUNCTIONS_KEY; import static org.sonar.api.measures.CoreMetrics.FUNCTION_COMPLEXITY_KEY; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/DistributionFormulaExecutionTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/DistributionFormulaExecutionTest.java index ee45417ead2..c944f37b9af 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/DistributionFormulaExecutionTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/DistributionFormulaExecutionTest.java @@ -32,7 +32,6 @@ import org.sonar.ce.task.projectanalysis.measure.MeasureRepositoryRule; import org.sonar.ce.task.projectanalysis.metric.MetricRepositoryRule; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION_KEY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.DIRECTORY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java index dade125e419..cdaec5e99d6 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java @@ -32,7 +32,6 @@ import org.sonar.ce.task.projectanalysis.measure.MeasureRepositoryRule; import org.sonar.ce.task.projectanalysis.metric.MetricRepositoryRule; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.LINES_KEY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.DIRECTORY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ViewsFormulaExecutorComponentVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ViewsFormulaExecutorComponentVisitorTest.java index 5fa55686568..544ed5972e7 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ViewsFormulaExecutorComponentVisitorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ViewsFormulaExecutorComponentVisitorTest.java @@ -34,7 +34,6 @@ import org.sonar.ce.task.projectanalysis.metric.Metric; import org.sonar.ce.task.projectanalysis.metric.MetricRepositoryRule; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.LINES_KEY; import static org.sonar.api.measures.CoreMetrics.NCLOC_KEY; import static org.sonar.api.measures.CoreMetrics.NEW_COVERAGE_KEY; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/FillComponentIssuesVisitorRule.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/FillComponentIssuesVisitorRule.java index 529ca5f54ef..e9314f3eb2d 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/FillComponentIssuesVisitorRule.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/FillComponentIssuesVisitorRule.java @@ -31,7 +31,6 @@ import org.sonar.ce.task.projectanalysis.component.TypeAwareVisitorAdapter; import org.sonar.core.issue.DefaultIssue; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import static java.util.Arrays.asList; import static org.sonar.ce.task.projectanalysis.component.ComponentVisitor.Order.POST_ORDER; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java index 6711ce436dc..993a8916f89 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java @@ -24,7 +24,6 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import java.util.stream.Stream; import javax.annotation.Nullable; import org.assertj.core.data.MapEntry; import org.junit.Rule; @@ -35,7 +34,6 @@ import org.sonar.ce.task.projectanalysis.analysis.Branch; import org.sonar.ce.task.projectanalysis.batch.BatchReportReaderRule; import org.sonar.ce.task.projectanalysis.component.Component; import org.sonar.ce.task.projectanalysis.component.TreeRootHolderRule; -import org.sonar.ce.task.projectanalysis.measure.Measure; import org.sonar.ce.task.projectanalysis.measure.MeasureRepoEntry; import org.sonar.ce.task.projectanalysis.measure.MeasureRepositoryRule; import org.sonar.ce.task.projectanalysis.metric.MetricRepositoryRule; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/NewEffortAggregatorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/NewEffortAggregatorTest.java index a3d020e2387..aa80737f60b 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/NewEffortAggregatorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/NewEffortAggregatorTest.java @@ -38,7 +38,6 @@ import org.sonar.db.component.BranchType; import org.sonar.db.newcodeperiod.NewCodePeriodType; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.sonar.api.issue.Issue.RESOLUTION_FIXED; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureLevelTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureLevelTest.java index 2be49cd29ab..8d6fc42d266 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureLevelTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureLevelTest.java @@ -22,7 +22,6 @@ package org.sonar.ce.task.projectanalysis.measure; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; public class MeasureLevelTest { @Test diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/ConditionEvaluatorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/ConditionEvaluatorTest.java index 476ed506cb0..ce108f85cc8 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/ConditionEvaluatorTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/ConditionEvaluatorTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableSet; import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; -import java.util.EnumSet; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -37,9 +36,9 @@ import static com.google.common.base.Predicates.not; import static com.google.common.collect.FluentIterable.from; import static java.util.Arrays.asList; import static org.junit.Assert.fail; -import static org.sonar.ce.task.projectanalysis.measure.Measure.newMeasureBuilder; import static org.sonar.ce.task.projectanalysis.measure.Measure.Level.ERROR; import static org.sonar.ce.task.projectanalysis.measure.Measure.Level.OK; +import static org.sonar.ce.task.projectanalysis.measure.Measure.newMeasureBuilder; import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType; import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.BOOL; import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.DATA; @@ -47,7 +46,6 @@ import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.DISTRIB import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.FLOAT; import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.INT; import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.LEVEL; -import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.MILLISEC; import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.PERCENT; import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.RATING; import static org.sonar.ce.task.projectanalysis.metric.Metric.MetricType.STRING; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java index 2a658c46292..784ce2f2352 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java @@ -70,7 +70,7 @@ public class SourceLinesDiffImplTest { } @Test - public void should_find_diff_with_target_branch_for_slbs() { + public void should_find_diff_with_target_branch_for_prs() { Component component = fileComponent(FILE_REF); Component componentInTarget = fileComponent(2); @@ -84,7 +84,7 @@ public class SourceLinesDiffImplTest { } @Test - public void should_find_diff_with_merge_branch_for_slbs_if_not_found_in_target() { + public void should_find_diff_with_merge_branch_for_prs_if_not_found_in_target() { Component component = fileComponent(FILE_REF); Component componentInTarget = fileComponent(2); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/BuildComponentTreeStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/BuildComponentTreeStepTest.java index f3be841d2a6..d1a0d9fbeef 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/BuildComponentTreeStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/BuildComponentTreeStepTest.java @@ -40,7 +40,6 @@ import org.sonar.ce.task.projectanalysis.component.ReportModulesPath; import org.sonar.ce.task.step.TestComputationStepContext; import org.sonar.db.DbClient; import org.sonar.db.DbTester; -import org.sonar.db.component.BranchType; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.SnapshotDto; import org.sonar.db.organization.OrganizationDto; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/CustomMeasuresCopyStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/CustomMeasuresCopyStepTest.java index 43d78064a22..28c9c05f5d7 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/CustomMeasuresCopyStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/CustomMeasuresCopyStepTest.java @@ -39,7 +39,6 @@ import org.sonar.db.measure.custom.CustomMeasureDto; import org.sonar.db.measure.custom.CustomMeasureTesting; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.ce.task.projectanalysis.component.Component.Type.DIRECTORY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.FILE; import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java index c004b473226..b25355e2fa5 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java @@ -61,7 +61,7 @@ public class LoadDuplicationsFromReportStepTest { builder(PROJECT, ROOT_REF) .addChildren( builder(FILE, FILE_1_REF).build(), - // status has no effect except if it's a SLB or PR + // status has no effect except if it's a PR builder(FILE, FILE_2_REF).setStatus(Component.Status.SAME).build()) .build()); @Rule diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java index 51b359c800e..42a454aecc9 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java @@ -355,7 +355,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { @Test @UseDataProvider("anyValidLeakPeriodSettingValue") - public void leak_period_setting_is_ignored_for_SLB_or_PR(NewCodePeriodType type, @Nullable String value) { + public void leak_period_setting_is_ignored_for_PR(NewCodePeriodType type, @Nullable String value) { when(analysisMetadataHolder.isLongLivingBranch()).thenReturn(false); dbTester.newCodePeriods().insert(type, value); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/NewCoverageMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/NewCoverageMeasuresStepTest.java index f14c11af75c..f8744388620 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/NewCoverageMeasuresStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/NewCoverageMeasuresStepTest.java @@ -42,7 +42,6 @@ import org.sonar.scanner.protocol.output.ScannerReport; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.sonar.api.measures.CoreMetrics.NEW_CONDITIONS_TO_COVER_KEY; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java index 03d3faf239e..a12efcef511 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java @@ -272,9 +272,9 @@ public class QualityGateEventsStepTest { @Test public void no_alert_on_pull_request_branches() { - Branch shortBranch = mock(Branch.class); - when(shortBranch.getType()).thenReturn(BranchType.PULL_REQUEST); - analysisMetadataHolder.setBranch(shortBranch); + Branch pr = mock(Branch.class); + when(pr.getType()).thenReturn(BranchType.PULL_REQUEST); + analysisMetadataHolder.setBranch(pr); TreeRootHolder treeRootHolder = mock(TreeRootHolder.class); MetricRepository metricRepository = mock(MetricRepository.class); MeasureRepository measureRepository = mock(MeasureRepository.class); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityProfileEventsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityProfileEventsStepTest.java index caa057d18ad..6219a2d31eb 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityProfileEventsStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityProfileEventsStepTest.java @@ -45,7 +45,6 @@ import org.sonar.ce.task.projectanalysis.measure.MeasureRepository; import org.sonar.ce.task.projectanalysis.metric.Metric; import org.sonar.ce.task.projectanalysis.metric.MetricRepository; import org.sonar.ce.task.projectanalysis.qualityprofile.MutableQProfileStatusRepository; -import org.sonar.ce.task.projectanalysis.qualityprofile.QProfileStatusRepository; import org.sonar.ce.task.projectanalysis.qualityprofile.QProfileStatusRepositoryImpl; import org.sonar.ce.task.step.TestComputationStepContext; import org.sonar.core.util.UtcDateUtils; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java index 96097ed096e..fbcd8650fa2 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java @@ -29,7 +29,6 @@ import org.sonar.ce.task.step.ComputationStep; import org.sonar.ce.task.step.TestComputationStepContext; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES_DENSITY; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES_DENSITY_KEY; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java index 6e22becc1c7..222b367b2c3 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java @@ -29,7 +29,6 @@ import org.sonar.ce.task.step.ComputationStep; import org.sonar.ce.task.step.TestComputationStepContext; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES_DENSITY; import static org.sonar.api.measures.CoreMetrics.COMMENT_LINES_DENSITY_KEY; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsComplexityMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsComplexityMeasuresStepTest.java index d6127526fdd..cfdec65ae36 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsComplexityMeasuresStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsComplexityMeasuresStepTest.java @@ -29,7 +29,6 @@ import org.sonar.ce.task.step.ComputationStep; import org.sonar.ce.task.step.TestComputationStepContext; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.CLASSES; import static org.sonar.api.measures.CoreMetrics.CLASSES_KEY; import static org.sonar.api.measures.CoreMetrics.CLASS_COMPLEXITY; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsLanguageDistributionMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsLanguageDistributionMeasuresStepTest.java index aa397d7fbca..3d665c57941 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsLanguageDistributionMeasuresStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsLanguageDistributionMeasuresStepTest.java @@ -28,7 +28,6 @@ import org.sonar.ce.task.step.ComputationStep; import org.sonar.ce.task.step.TestComputationStepContext; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION; import static org.sonar.api.measures.CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION_KEY; import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT_VIEW; diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsUnitTestMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsUnitTestMeasuresStepTest.java index df3c9141710..9771d4c3cd2 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsUnitTestMeasuresStepTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsUnitTestMeasuresStepTest.java @@ -28,7 +28,6 @@ import org.sonar.ce.task.step.ComputationStep; import org.sonar.ce.task.step.TestComputationStepContext; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.guava.api.Assertions.assertThat; import static org.sonar.api.measures.CoreMetrics.SKIPPED_TESTS; import static org.sonar.api.measures.CoreMetrics.SKIPPED_TESTS_KEY; import static org.sonar.api.measures.CoreMetrics.TESTS; diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java b/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java index 6e7e2c32d2c..40ee287d0e6 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java +++ b/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java @@ -45,7 +45,6 @@ import static com.google.common.collect.Lists.newArrayList; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import static org.mockito.Answers.CALLS_REAL_METHODS; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; @@ -53,7 +52,6 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import static org.sonar.db.DatabaseUtils.toUniqueAndSortedList; public class DatabaseUtilsTest { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java index a52af3d913e..79c428cf7e2 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java @@ -73,7 +73,7 @@ import org.sonar.db.issue.IssueChangeDto; import org.sonar.db.issue.IssueChangeMapper; import org.sonar.db.issue.IssueDto; import org.sonar.db.issue.IssueMapper; -import org.sonar.db.issue.ShortBranchIssueDto; +import org.sonar.db.issue.PrIssueDto; import org.sonar.db.mapping.ProjectMappingDto; import org.sonar.db.mapping.ProjectMappingsMapper; import org.sonar.db.measure.LiveMeasureMapper; @@ -190,7 +190,6 @@ public class MyBatis implements Startable { confBuilder.loadAlias("IssueChange", IssueChangeDto.class); confBuilder.loadAlias("KeyLongValue", KeyLongValue.class); confBuilder.loadAlias("Issue", IssueDto.class); - confBuilder.loadAlias("ShortBranchIssue", ShortBranchIssueDto.class); confBuilder.loadAlias("Measure", MeasureDto.class); confBuilder.loadAlias("NotificationQueue", NotificationQueueDto.class); confBuilder.loadAlias("Organization", OrganizationDto.class); @@ -200,6 +199,7 @@ public class MyBatis implements Startable { confBuilder.loadAlias("PermissionTemplate", PermissionTemplateDto.class); confBuilder.loadAlias("PermissionTemplateUser", PermissionTemplateUserDto.class); confBuilder.loadAlias("Plugin", PluginDto.class); + confBuilder.loadAlias("PrIssue", PrIssueDto.class); confBuilder.loadAlias("ProjectAlmBinding", ProjectAlmBindingDto.class); confBuilder.loadAlias("ProjectQgateAssociation", ProjectQgateAssociationDto.class); confBuilder.loadAlias("ProjectMapping", ProjectMappingDto.class); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java index 17289805693..08dee30c11c 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java @@ -74,8 +74,8 @@ public class BranchDto { /** * UUID of the branch: - * - in which the short-lived branch or pull request will be merged into - * - that is the base of long-lived branch. + * - in which the pull request will be merged into + * - that is the base of a branch. * <p> * Can be null if information is not known. */ diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java index 3b2802be577..214dfb66006 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java @@ -42,7 +42,6 @@ import org.sonar.db.DbSession; import static com.google.common.base.Preconditions.checkArgument; import static org.sonar.core.component.ComponentKeys.checkProjectKey; -import static org.sonar.core.component.ComponentKeys.isValidProjectKey; /** * Class used to rename the key of a project and its resources. diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentQuery.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentQuery.java index c393546898d..77fd0367097 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentQuery.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentQuery.java @@ -200,7 +200,7 @@ public class ComponentQuery { /** * Filter on date of last analysis. On projects, all branches and pull requests are taken into - * account. For example the analysis of a short-lived branch is included in the filter + * account. For example the analysis of a branch is included in the filter * even if the main branch has never been analyzed. */ public Builder setAnyBranchAnalyzedAfter(@Nullable Long l) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java index 60da3909145..5df0ed95259 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDao.java @@ -23,7 +23,6 @@ import java.util.Collection; import java.util.List; import java.util.Optional; import java.util.Set; - import org.sonar.db.Dao; import org.sonar.db.DbSession; import org.sonar.db.RowNotFoundException; @@ -74,7 +73,7 @@ public class IssueDao implements Dao { return mapper(dbSession).selectNonClosedByModuleOrProject(module.projectUuid(), likeModuleUuidPath); } - public List<ShortBranchIssueDto> selectOpenByComponentUuids(DbSession dbSession, Collection<String> componentUuids) { + public List<PrIssueDto> selectOpenByComponentUuids(DbSession dbSession, Collection<String> componentUuids) { return executeLargeInputs(componentUuids, mapper(dbSession)::selectOpenByComponentUuids); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java index e399267440d..cece3bf833c 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java @@ -38,7 +38,7 @@ public interface IssueMapper { List<IssueDto> selectByKeysIfNotUpdatedAt(@Param("keys") List<String> keys, @Param("updatedAt") long updatedAt); - List<ShortBranchIssueDto> selectOpenByComponentUuids(List<String> componentUuids); + List<PrIssueDto> selectOpenByComponentUuids(List<String> componentUuids); void insert(IssueDto issue); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ShortBranchIssueDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/PrIssueDto.java index bdb34339ab8..cebbc06f3a0 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/ShortBranchIssueDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/PrIssueDto.java @@ -27,7 +27,7 @@ import org.apache.commons.lang.builder.ToStringStyle; import org.sonar.api.rule.RuleKey; import org.sonar.db.component.KeyType; -public final class ShortBranchIssueDto implements Serializable { +public final class PrIssueDto implements Serializable { private String kee; private String message; @@ -46,7 +46,7 @@ public final class ShortBranchIssueDto implements Serializable { return kee; } - public ShortBranchIssueDto setKee(String s) { + public PrIssueDto setKee(String s) { this.kee = s; return this; } @@ -56,7 +56,7 @@ public final class ShortBranchIssueDto implements Serializable { return message; } - public ShortBranchIssueDto setMessage(@Nullable String s) { + public PrIssueDto setMessage(@Nullable String s) { this.message = s; return this; } @@ -66,7 +66,7 @@ public final class ShortBranchIssueDto implements Serializable { return line; } - public ShortBranchIssueDto setLine(@Nullable Integer i) { + public PrIssueDto setLine(@Nullable Integer i) { this.line = i; return this; } @@ -78,7 +78,7 @@ public final class ShortBranchIssueDto implements Serializable { return branchKey; } - public ShortBranchIssueDto setBranchKey(String s) { + public PrIssueDto setBranchKey(String s) { this.branchKey = s; return this; } @@ -87,7 +87,7 @@ public final class ShortBranchIssueDto implements Serializable { return keyType; } - public ShortBranchIssueDto setKeyType(KeyType s) { + public PrIssueDto setKeyType(KeyType s) { this.keyType = s; return this; } @@ -96,7 +96,7 @@ public final class ShortBranchIssueDto implements Serializable { return status; } - public ShortBranchIssueDto setStatus(@Nullable String s) { + public PrIssueDto setStatus(@Nullable String s) { this.status = s; return this; } @@ -106,7 +106,7 @@ public final class ShortBranchIssueDto implements Serializable { return checksum; } - public ShortBranchIssueDto setChecksum(@Nullable String s) { + public PrIssueDto setChecksum(@Nullable String s) { this.checksum = s; return this; } @@ -127,7 +127,7 @@ public final class ShortBranchIssueDto implements Serializable { return issueUpdateDate; } - public ShortBranchIssueDto setIssueUpdateDate(Long issueUpdateDate) { + public PrIssueDto setIssueUpdateDate(Long issueUpdateDate) { this.issueUpdateDate = issueUpdateDate; return this; } diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml index 499f37a3cdb..8aba7f1cd67 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml @@ -289,7 +289,7 @@ and i.updated_at <> #{updatedAt,jdbcType=BIGINT} </select> - <select id="selectOpenByComponentUuids" parameterType="map" resultType="ShortBranchIssue"> + <select id="selectOpenByComponentUuids" parameterType="map" resultType="PrIssue"> select i.kee as kee, i.message as message, diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java index 2361a6872a5..fffce192a76 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java @@ -225,7 +225,7 @@ public class IssueDaoTest { ComponentDto file = db.components().insertComponent(newFileDto(projectBranch)); IssueDto fpIssue = db.issues().insert(rule, projectBranch, file, i -> i.setStatus("RESOLVED").setResolution("FALSE-POSITIVE")); - ShortBranchIssueDto fp = underTest.selectOpenByComponentUuids(db.getSession(), Collections.singletonList(file.uuid())).get(0); + PrIssueDto fp = underTest.selectOpenByComponentUuids(db.getSession(), Collections.singletonList(file.uuid())).get(0); assertThat(fp.getLine()).isEqualTo(fpIssue.getLine()); assertThat(fp.getMessage()).isEqualTo(fpIssue.getMessage()); assertThat(fp.getChecksum()).isEqualTo(fpIssue.getChecksum()); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDtoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDtoTest.java index a496b042d71..f460b707d3a 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDtoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDtoTest.java @@ -25,9 +25,6 @@ import org.junit.rules.ExpectedException; import static com.google.common.base.Strings.repeat; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.api.measures.Metric.ValueType.DATA; -import static org.sonar.api.measures.Metric.ValueType.INT; -import static org.sonar.api.measures.Metric.ValueType.STRING; public class MetricDtoTest { @Rule diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java index cb7a8fbdaf5..978855b5092 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java @@ -31,7 +31,6 @@ import org.sonar.api.web.UserRole; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.organization.OrganizationDto; -import org.sonar.db.permission.PermissionQuery; import org.sonar.db.user.GroupDto; import org.sonar.db.user.UserDto; diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java index 3eb348a8797..ed75ec4e818 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java @@ -19,7 +19,6 @@ */ package org.sonar.db.rule; -import com.hazelcast.map.impl.querycache.accumulator.Accumulator; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java index 1f02bd04a34..ca072da52a1 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java @@ -19,7 +19,6 @@ */ package org.sonar.db.user; -import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import java.util.ArrayList; import java.util.Collection; @@ -28,9 +27,9 @@ import java.util.List; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.sonar.api.impl.utils.TestSystem2; import org.sonar.api.user.UserQuery; import org.sonar.api.utils.DateUtils; -import org.sonar.api.impl.utils.TestSystem2; import org.sonar.db.DatabaseUtils; import org.sonar.db.DbClient; import org.sonar.db.DbSession; diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java index 2eced5e23ed..627981dc371 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java @@ -25,8 +25,6 @@ import javax.annotation.Nullable; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; -import org.sonar.db.newcodeperiod.NewCodePeriodDto; -import org.sonar.db.newcodeperiod.NewCodePeriodType; import org.sonar.db.organization.OrganizationDto; import static com.google.common.base.Preconditions.checkArgument; diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java index fe673114962..adf551ef4c3 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java @@ -20,7 +20,6 @@ package org.sonar.server.platform.db.migration.version.v80; import java.sql.SQLException; -import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; import java.util.Map; diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/AbstractCommandTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/AbstractCommandTest.java index b76c0a0d55d..2f57da05620 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/AbstractCommandTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/AbstractCommandTest.java @@ -23,7 +23,6 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; -import java.util.Properties; import java.util.Random; import java.util.stream.Collectors; import java.util.stream.IntStream; diff --git a/server/sonar-main/src/test/java/org/sonar/application/process/StreamGobblerTest.java b/server/sonar-main/src/test/java/org/sonar/application/process/StreamGobblerTest.java index e8cbbe1e795..4451ba9993e 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/process/StreamGobblerTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/process/StreamGobblerTest.java @@ -23,7 +23,6 @@ import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.junit.Test; import org.slf4j.Logger; -import org.sonar.application.process.StreamGobbler; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/NotConditionTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/NotConditionTest.java index 77c629f9c3f..6efc8526efa 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/NotConditionTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/NotConditionTest.java @@ -22,8 +22,6 @@ package org.sonar.server.issue.workflow; import org.junit.Test; import org.mockito.Mockito; import org.sonar.api.issue.Issue; -import org.sonar.server.issue.workflow.Condition; -import org.sonar.server.issue.workflow.NotCondition; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/setting/DatabaseSettingsEnablerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/setting/DatabaseSettingsEnablerTest.java index bf43417d73c..60a71030aa3 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/setting/DatabaseSettingsEnablerTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/setting/DatabaseSettingsEnablerTest.java @@ -23,9 +23,6 @@ import org.junit.After; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.sonar.server.setting.DatabaseSettingLoader; -import org.sonar.server.setting.DatabaseSettingsEnabler; -import org.sonar.server.setting.ThreadLocalSettings; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/BranchTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/BranchTest.java index eb46a936c84..b4b7e252392 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/BranchTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/BranchTest.java @@ -30,7 +30,7 @@ public class BranchTest { @Rule public ExpectedException expectedException = ExpectedException.none(); - private Branch underTest = new Branch(true, "b", Branch.Type.SHORT); + private Branch underTest = new Branch(true, "b", Branch.Type.LONG); @Test public void constructor_throws_NPE_if_type_is_null() { @@ -44,7 +44,7 @@ public class BranchTest { public void verify_getters() { assertThat(underTest.isMain()).isTrue(); assertThat(underTest.getName()).contains("b"); - assertThat(underTest.getType()).isEqualTo(Branch.Type.SHORT); + assertThat(underTest.getType()).isEqualTo(Branch.Type.LONG); Branch underTestWithNull = new Branch(false, null, Branch.Type.LONG); diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java index d36f6137f87..a704f352d67 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/ProjectAnalysisTest.java @@ -39,7 +39,7 @@ public class ProjectAnalysisTest { private final CeTask ceTask = new CeTask("id", CeTask.Status.SUCCESS); private final Project project = new Project("uuid", "key", "name"); private final Analysis analysis = new Analysis("analysis_uuid", 1_500L, "sha1"); - private final Branch branch = new Branch(true, "name", Branch.Type.SHORT); + private final Branch branch = new Branch(true, "name", Branch.Type.LONG); private final EvaluatedQualityGate qualityGate = EvaluatedQualityGate.newBuilder() .setQualityGate(new QualityGate("id", "name", emptySet())) .setStatus(Metric.Level.ERROR) @@ -105,7 +105,7 @@ public class ProjectAnalysisTest { assertThat(underTest).isNotEqualTo(new ProjectAnalysis(project, ceTask, null, null, qualityGate, 1L, properties)); assertThat(underTest).isNotEqualTo(new ProjectAnalysis(project, ceTask, new Analysis("foo", 1_500L, "sha1"), null, qualityGate, 1L, properties)); assertThat(underTest).isNotEqualTo(new ProjectAnalysis(project, ceTask, analysis, null, qualityGate, 1L, properties)); - assertThat(underTest).isNotEqualTo(new ProjectAnalysis(project, ceTask, analysis, new Branch(false, "B", Branch.Type.SHORT), qualityGate, 1L, properties)); + assertThat(underTest).isNotEqualTo(new ProjectAnalysis(project, ceTask, analysis, new Branch(false, "B", Branch.Type.LONG), qualityGate, 1L, properties)); assertThat(underTest).isNotEqualTo(new ProjectAnalysis(project, ceTask, analysis, branch, null, 1L, properties)); EvaluatedQualityGate otherQualityGate = EvaluatedQualityGate.newBuilder() .setQualityGate(new QualityGate("A", "B", emptySet())) diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookModuleTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookModuleTest.java index d7f0becc498..4d3b1f7f9ac 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookModuleTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookModuleTest.java @@ -23,7 +23,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.core.platform.ComponentContainer; -import org.sonar.server.webhook.WebhookModule; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER; diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java index 38fd069e22a..d8534ce4335 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java @@ -232,23 +232,6 @@ public class WebhookPayloadFactoryImplTest { } @Test - public void create_payload_on_short_branch() { - CeTask task = new CeTask("#1", CeTask.Status.SUCCESS); - ProjectAnalysis analysis = newAnalysis(task, null, new Branch(false, "feature/foo", Branch.Type.SHORT), 1_500_000_000_000L, emptyMap()); - - WebhookPayload payload = underTest.create(analysis); - assertJson(payload.getJson()) - .isSimilarTo("{" + - "\"branch\": {" + - " \"name\": \"feature/foo\"," + - " \"type\": \"SHORT\"," + - " \"isMain\": false," + - " \"url\": \"http://foo/dashboard?id=P1&branch=feature%2Ffoo\"" + - "}" + - "}"); - } - - @Test public void create_payload_on_pull_request() { CeTask task = new CeTask("#1", CeTask.Status.SUCCESS); ProjectAnalysis analysis = newAnalysis(task, null, new Branch(false, "pr/foo", Branch.Type.PULL_REQUEST), 1_500_000_000_000L, emptyMap()); diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterUpdateTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterUpdateTest.java index 6e742c79a0b..2e552ac09d9 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterUpdateTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterUpdateTest.java @@ -40,7 +40,6 @@ import org.sonar.server.authentication.CredentialsLocalAuthentication; import org.sonar.server.es.EsTester; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.organization.DefaultOrganizationProvider; -import org.sonar.server.organization.OrganizationUpdater; import org.sonar.server.organization.TestDefaultOrganizationProvider; import org.sonar.server.organization.TestOrganizationFlags; import org.sonar.server.user.index.UserIndexDefinition; diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/migration/DatabaseMigrationExecutorServiceAdaptor.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/migration/DatabaseMigrationExecutorServiceAdaptor.java index 736d056c22b..a28b32e6da8 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/migration/DatabaseMigrationExecutorServiceAdaptor.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/db/migration/DatabaseMigrationExecutorServiceAdaptor.java @@ -22,10 +22,8 @@ package org.sonar.server.platform.db.migration; import java.util.Collection; import java.util.List; import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; /** * Adaptor for the DatabaseMigrationExecutorService interface which implementation of methods all throw diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/duplication/ws/Duplication.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/duplication/ws/Duplication.java index 089093cbc91..c393fac6e8b 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/duplication/ws/Duplication.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/duplication/ws/Duplication.java @@ -68,7 +68,7 @@ public class Duplication { /** * can be null if the file wasn't found in DB. This can happen if the target was removed (cross-project duplications) or - * if the target refers to an unchanged file in SLBs/PRs. + * if the target refers to an unchanged file in PRs. */ @CheckForNull public ComponentDto componentDto() { diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java index fe2b20417e0..835ee7c4c06 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java @@ -73,7 +73,7 @@ public class DuplicationsParser { String componentDbKey = bCursor.getAttrValue("r"); if (from != null && size != null && componentDbKey != null) { if (disableLink) { - // flag means that the target refers to an unchanged file in SLBs/PRs that doesn't exist in DB. + // flag means that the target refers to an unchanged file in PRs that doesn't exist in DB. // Display as text without a link or other details. duplications.add(Duplication.newTextComponent(componentDbKey, Integer.valueOf(from), Integer.valueOf(size))); } else { diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureComputerImpl.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureComputerImpl.java index 35a375d4e75..3dccde3860a 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureComputerImpl.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/LiveMeasureComputerImpl.java @@ -123,7 +123,7 @@ public class LiveMeasureComputerImpl implements LiveMeasureComputer { components.forEach(c -> { IssueCounter issueCounter = new IssueCounter(dbClient.issueDao().selectIssueGroupsByBaseComponent(dbSession, c, beginningOfLeak)); for (IssueMetricFormula formula : formulaFactory.getFormulas()) { - // use formulas when the leak period is defined, it's a PR/SLB, or the formula is not about the leak period + // use formulas when the leak period is defined, it's a PR, or the formula is not about the leak period if (shouldUseLeakFormulas(lastAnalysis.get(), branch) || !formula.isOnLeak()) { context.change(c, formula); try { diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/HasMeasure.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/HasMeasure.java index 963e80b5bee..ba5e8b2ac04 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/HasMeasure.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/HasMeasure.java @@ -23,7 +23,6 @@ import com.google.common.collect.Table; import java.util.function.Predicate; import javax.annotation.Nonnull; import javax.annotation.Nullable; - import org.sonar.db.component.ComponentDto; import org.sonar.db.metric.MetricDto; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/SearchAction.java index 9d843421db6..05fb13ee6b8 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/SearchAction.java @@ -24,7 +24,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import javax.annotation.Nullable; -import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; @@ -44,7 +43,6 @@ import org.sonar.server.user.UserSession; import org.sonarqube.ws.Projects.SearchWsResponse; import static com.google.common.base.Preconditions.checkArgument; -import static java.lang.String.format; import static java.util.Optional.ofNullable; import static java.util.function.Function.identity; import static org.sonar.api.resources.Qualifiers.APP; @@ -52,8 +50,6 @@ import static org.sonar.api.resources.Qualifiers.PROJECT; import static org.sonar.api.resources.Qualifiers.VIEW; import static org.sonar.api.utils.DateUtils.formatDateTime; import static org.sonar.api.utils.DateUtils.parseDateOrDateTime; -import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; -import static org.sonar.core.util.Uuids.UUID_EXAMPLE_02; import static org.sonar.server.project.Visibility.PRIVATE; import static org.sonar.server.project.Visibility.PUBLIC; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; @@ -67,7 +63,6 @@ import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ANALYZE import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ON_PROVISIONED_ONLY; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ORGANIZATION; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECTS; -import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_IDS; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_QUALIFIERS; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_VISIBILITY; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java index dc8a7b4904d..bda2c1022a1 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java @@ -27,7 +27,6 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.resources.Qualifiers; -import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java index 53b7e2938ab..01a960c6061 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java @@ -22,9 +22,7 @@ package org.sonar.server.projectanalysis.ws; import com.google.common.collect.ImmutableSet; import java.util.EnumSet; import java.util.List; -import java.util.Optional; import java.util.Set; -import javax.annotation.Nullable; import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.Scopes; import org.sonar.api.server.ws.Change; @@ -36,8 +34,6 @@ import org.sonar.api.web.UserRole; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.BranchDao; -import org.sonar.db.component.BranchDto; -import org.sonar.db.component.BranchType; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.SnapshotDto; import org.sonar.db.component.SnapshotQuery; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SetBaselineAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SetBaselineAction.java index 9eafd55f547..29ea97d895a 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SetBaselineAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SetBaselineAction.java @@ -29,7 +29,6 @@ import org.sonar.core.util.Uuids; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.BranchDto; -import org.sonar.db.component.BranchType; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.SnapshotDto; import org.sonar.db.newcodeperiod.NewCodePeriodDto; diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/DecorationDataHolder.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/DecorationDataHolder.java index d667e1e7e11..fca9afe3466 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/DecorationDataHolder.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/source/DecorationDataHolder.java @@ -20,7 +20,6 @@ package org.sonar.server.source; import com.google.common.collect.Lists; - import java.util.Arrays; import java.util.Iterator; import java.util.List; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java index 763ced87578..40b04a07dd8 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java @@ -74,7 +74,6 @@ import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY; import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY; import static org.sonar.db.ce.CeTaskCharacteristicDto.PULL_REQUEST; import static org.sonar.db.component.BranchType.BRANCH; -import static org.sonar.db.component.BranchType.LONG; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MIN_SUBMITTED_AT; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java index 63d73272e5b..34de2ceca85 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java @@ -56,7 +56,6 @@ import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION; import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY; import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY; import static org.sonar.db.component.BranchType.BRANCH; -import static org.sonar.db.component.BranchType.LONG; import static org.sonar.db.permission.OrganizationPermission.SCAN; public class TaskActionTest { diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/newcodeperiod/ws/SetActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/newcodeperiod/ws/SetActionTest.java index 4981da7a3d2..f838fdc0c0c 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/newcodeperiod/ws/SetActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/newcodeperiod/ws/SetActionTest.java @@ -37,7 +37,6 @@ import org.sonar.core.util.UuidFactoryFast; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; -import org.sonar.db.component.BranchType; import org.sonar.db.component.ComponentDbTester; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.SnapshotDto; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/SearchActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/SearchActionTest.java index 9e971802ba8..ef3fcbfa4db 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/SearchActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/SearchActionTest.java @@ -71,7 +71,6 @@ import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ANALYZE import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ON_PROVISIONED_ONLY; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ORGANIZATION; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECTS; -import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_IDS; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_VISIBILITY; public class SearchActionTest { diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileBackuperImplTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileBackuperImplTest.java index 58bd3b1d697..f969b74baf8 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileBackuperImplTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileBackuperImplTest.java @@ -43,7 +43,6 @@ import org.sonar.db.qualityprofile.ActiveRuleDto; import org.sonar.db.qualityprofile.ActiveRuleParamDto; import org.sonar.db.qualityprofile.QProfileDto; import org.sonar.db.qualityprofile.QualityProfileTesting; -import org.sonar.db.qualityprofile.RulesProfileDto; import org.sonar.db.rule.RuleDefinitionDto; import org.sonar.db.rule.RuleMetadataDto; import org.sonar.db.rule.RuleParamDto; @@ -56,7 +55,6 @@ import static org.junit.rules.ExpectedException.none; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class QProfileBackuperImplTest { diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileCopierTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileCopierTest.java index c295b125452..cf0cb69f623 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileCopierTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileCopierTest.java @@ -19,12 +19,8 @@ */ package org.sonar.server.qualityprofile; -import java.io.IOException; -import java.io.Reader; -import java.io.Writer; import java.util.Collection; import javax.annotation.Nullable; -import org.apache.commons.io.IOUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/CopyActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/CopyActionTest.java index 47eab237d23..03d90129713 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/CopyActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/CopyActionTest.java @@ -40,7 +40,6 @@ import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.language.LanguageTesting; import org.sonar.server.organization.DefaultOrganizationProvider; import org.sonar.server.organization.TestDefaultOrganizationProvider; -import org.sonar.server.qualityprofile.BulkChangeResult; import org.sonar.server.qualityprofile.QProfileBackuper; import org.sonar.server.qualityprofile.QProfileCopier; import org.sonar.server.qualityprofile.QProfileFactory; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/IndexActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/IndexActionTest.java index 6c851001cde..66ccf817752 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/IndexActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/IndexActionTest.java @@ -19,7 +19,6 @@ */ package org.sonar.server.source.ws; -import java.io.IOException; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java index 4dc969595a1..a5fbffc264b 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java @@ -19,7 +19,6 @@ */ package org.sonar.server.user.ws; -import java.io.IOException; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; |