aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-scanner-engine/src')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java7
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java10
2 files changed, 5 insertions, 12 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java
index 68612147d9d..740a8c68659 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java
@@ -25,7 +25,6 @@ import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
-import org.sonar.scanner.scan.branch.BranchConfiguration;
@Immutable
public class DefaultAnalysisMode implements AnalysisMode {
@@ -34,12 +33,10 @@ public class DefaultAnalysisMode implements AnalysisMode {
private final Map<String, String> analysisProps;
private final GlobalAnalysisMode analysisMode;
- private final BranchConfiguration branchConfig;
private boolean scanAllFiles;
- public DefaultAnalysisMode(AnalysisProperties props, BranchConfiguration branchConfig, GlobalAnalysisMode analysisMode) {
- this.branchConfig = branchConfig;
+ public DefaultAnalysisMode(AnalysisProperties props, GlobalAnalysisMode analysisMode) {
this.analysisMode = analysisMode;
this.analysisProps = props.properties();
load();
@@ -58,7 +55,7 @@ public class DefaultAnalysisMode implements AnalysisMode {
private void load() {
String scanAllStr = analysisProps.get(KEY_SCAN_ALL);
- scanAllFiles = !branchConfig.isShortLivingBranch() && (!analysisMode.isIssues() || "true".equals(scanAllStr));
+ scanAllFiles = !analysisMode.isIssues() || "true".equals(scanAllStr);
}
@Override
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java
index 9e896ecdc56..df003ae4e8e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java
@@ -25,19 +25,16 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
-import org.sonar.scanner.scan.branch.BranchConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class DefaultAnalysisModeTest {
- private BranchConfiguration branchConfig;
private GlobalAnalysisMode globalMode;
@Before
public void setUp() {
- branchConfig = mock(BranchConfiguration.class);
globalMode = mock(GlobalAnalysisMode.class);
}
@@ -45,12 +42,11 @@ public class DefaultAnalysisModeTest {
public ExpectedException thrown = ExpectedException.none();
@Test
- public void dont_scan_all_if_short_lived_branch() {
+ public void scan_all_even_on_short_lived_branch() {
AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.scanAllFiles", "true"));
- when(branchConfig.isShortLivingBranch()).thenReturn(true);
DefaultAnalysisMode mode = createmode(analysisProps);
- assertThat(mode.scanAllFiles()).isFalse();
+ assertThat(mode.scanAllFiles()).isTrue();
}
@Test
@@ -90,7 +86,7 @@ public class DefaultAnalysisModeTest {
}
private DefaultAnalysisMode createmode(AnalysisProperties analysisProps) {
- return new DefaultAnalysisMode(analysisProps, branchConfig, globalMode);
+ return new DefaultAnalysisMode(analysisProps, globalMode);
}
}