]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorJulien HENRY <julien.henry@sonarsource.com>
Wed, 8 Oct 2014 09:35:55 +0000 (11:35 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Wed, 8 Oct 2014 09:36:19 +0000 (11:36 +0200)
sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java
sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultFileLinesContextFactory.java
sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java
sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java
sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java

index 772f773cb5f040257f105d5419f17418af216951..59f1e667edd59b88585c30dfe7865ef93edadd7e 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.batch.scan.filesystem;
 
 import org.sonar.api.BatchComponent;
 import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.resources.Project;
 import org.sonar.api.scan.filesystem.PathResolver;
 import org.sonar.batch.bootstrap.AnalysisMode;
 
@@ -33,17 +32,9 @@ public class InputFileBuilderFactory implements BatchComponent {
   private final StatusDetectionFactory statusDetectionFactory;
   private final AnalysisMode analysisMode;
 
-  public InputFileBuilderFactory(Project module, ProjectDefinition def, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory,
-    StatusDetectionFactory statusDetectionFactory, AnalysisMode analysisMode) {
-    this(module.getEffectiveKey(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode);
-  }
-
-  /**
-   * Used by scan2
-   */
   public InputFileBuilderFactory(ProjectDefinition def, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory,
     StatusDetectionFactory statusDetectionFactory, AnalysisMode analysisMode) {
-    this(def.getKey(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode);
+    this(def.getKeyWithBranch(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode);
   }
 
   private InputFileBuilderFactory(String effectiveKey, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory,
index 603cf47bb3fe6e5475c4a96a43a6ed620b9d12d7..8805ac83d890ddc3f88c32dbd4869df6766802c1 100644 (file)
@@ -20,7 +20,6 @@
 package org.sonar.batch.scan2;
 
 import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.batch.fs.FileSystem;
 import org.sonar.api.batch.fs.InputFile;
 import org.sonar.api.batch.measure.MetricFinder;
 import org.sonar.api.measures.FileLinesContext;
@@ -35,7 +34,7 @@ public class DefaultFileLinesContextFactory implements FileLinesContextFactory {
   private final ProjectDefinition def;
   private InputPathCache fileCache;
 
-  public DefaultFileLinesContextFactory(InputPathCache fileCache, FileSystem fs, MetricFinder metricFinder, AnalyzerMeasureCache measureCache,
+  public DefaultFileLinesContextFactory(InputPathCache fileCache, MetricFinder metricFinder, AnalyzerMeasureCache measureCache,
     ProjectDefinition def) {
     this.fileCache = fileCache;
     this.metricFinder = metricFinder;
index 67e2a37908d8cf1f45b50213d317ac92202f1d9f..41a2cda0390f35810807d354aeb7fb9fa30d12a3 100644 (file)
@@ -139,7 +139,7 @@ public class ModuleScanContainer extends ComponentContainer {
 
   @Override
   protected void doAfterStart() {
-    getComponentByType(ModuleScanExecutor.class).execute(moduleDefinition);
+    getComponentByType(ModuleScanExecutor.class).execute();
   }
 
 }
index 8611bd3b26a20f28833f2b969908408907f8592f..088125818df0ec616a670dae7d5d216e2d5200f2 100644 (file)
@@ -20,7 +20,6 @@
 package org.sonar.batch.scan2;
 
 import com.google.common.collect.Lists;
-import org.sonar.api.batch.bootstrap.ProjectDefinition;
 import org.sonar.api.batch.sensor.SensorContext;
 import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader;
 import org.sonar.batch.rule.QProfileVerifier;
@@ -60,7 +59,7 @@ public final class ModuleScanExecutor {
   /**
    * Executed on each module
    */
-  public void execute(ProjectDefinition moduleDefinition) {
+  public void execute() {
     fsLogger.log();
 
     // Index and lock the filesystem
index e38081b62be0bcdcc833744385cbf3d04674584d..bb78a170c842eac9d6d96a492608a0dd43b38671 100644 (file)
@@ -22,7 +22,6 @@ package org.sonar.batch.scan.filesystem;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.resources.Project;
 import org.sonar.api.scan.filesystem.PathResolver;
 import org.sonar.batch.bootstrap.AnalysisMode;
 
@@ -33,14 +32,12 @@ public class InputFileBuilderFactoryTest {
   @Test
   public void create_builder() throws Exception {
     PathResolver pathResolver = new PathResolver();
-    Project project = new Project("struts");
     LanguageDetectionFactory langDetectionFactory = mock(LanguageDetectionFactory.class, Mockito.RETURNS_MOCKS);
     StatusDetectionFactory statusDetectionFactory = mock(StatusDetectionFactory.class, Mockito.RETURNS_MOCKS);
     DefaultModuleFileSystem fs = mock(DefaultModuleFileSystem.class);
     AnalysisMode analysisMode = mock(AnalysisMode.class);
 
-    InputFileBuilderFactory factory = new InputFileBuilderFactory(
-      project, ProjectDefinition.create(), pathResolver, langDetectionFactory,
+    InputFileBuilderFactory factory = new InputFileBuilderFactory(ProjectDefinition.create().setKey("struts"), pathResolver, langDetectionFactory,
       statusDetectionFactory, analysisMode);
     InputFileBuilder builder = factory.create(fs);