aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java/org
diff options
context:
space:
mode:
authorMichal Duda <michalno1@gmail.com>2018-11-13 11:00:42 +0100
committersonartech <sonartech@sonarsource.com>2019-01-16 09:43:00 +0100
commit6dd294b1f5af7c74191db30101e3721d00102204 (patch)
tree372dbc219371a610c32fb8b723869291a7148c5f /sonar-scanner-engine/src/main/java/org
parentb44c75c2b93ca2d91d6ce559a08a0d994c73bd85 (diff)
downloadsonarqube-6dd294b1f5af7c74191db30101e3721d00102204.tar.gz
sonarqube-6dd294b1f5af7c74191db30101e3721d00102204.zip
SONAR-11459 move dir and module issues to root
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/TaskResult.java8
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java9
2 files changed, 14 insertions, 3 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/TaskResult.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/TaskResult.java
index b510f895a51..d2ea9681433 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/TaskResult.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/TaskResult.java
@@ -36,6 +36,7 @@ import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.InputComponent;
import org.sonar.api.batch.fs.InputDir;
import org.sonar.api.batch.fs.InputFile;
+import org.sonar.api.batch.fs.InputModule;
import org.sonar.api.batch.fs.TextPointer;
import org.sonar.api.batch.fs.TextRange;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
@@ -63,6 +64,7 @@ public class TaskResult implements org.sonar.scanner.mediumtest.ScanTaskObserver
private Map<String, InputFile> inputFiles = new HashMap<>();
private Map<String, Component> reportComponents = new HashMap<>();
private Map<String, InputDir> inputDirs = new HashMap<>();
+ private InputModule root;
private ScannerReportReader reader;
@Override
@@ -78,6 +80,8 @@ public class TaskResult implements org.sonar.scanner.mediumtest.ScanTaskObserver
Metadata readMetadata = getReportReader().readMetadata();
int rootComponentRef = readMetadata.getRootComponentRef();
storeReportComponents(rootComponentRef, null);
+ InputComponentStore inputFileCache = container.getComponentByType(InputComponentStore.class);
+ root = inputFileCache.root();
}
storeFs(container);
@@ -154,6 +158,10 @@ public class TaskResult implements org.sonar.scanner.mediumtest.ScanTaskObserver
return result;
}
+ public InputModule root() {
+ return root;
+ }
+
public Collection<InputFile> inputFiles() {
return inputFiles.values();
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java
index 1df2834b0eb..ed8640d7732 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorContext.java
@@ -27,6 +27,7 @@ import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.InputModule;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
+import org.sonar.api.batch.fs.internal.InputModuleHierarchy;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.code.NewSignificantCode;
@@ -79,9 +80,10 @@ public class DefaultSensorContext implements SensorContext {
private final InputModule module;
private final SonarRuntime sonarRuntime;
private final Configuration config;
+ private final InputModuleHierarchy hierarchy;
public DefaultSensorContext(InputModule module, Configuration config, Settings mutableSettings, FileSystem fs, ActiveRules activeRules,
- AnalysisMode analysisMode, SensorStorage sensorStorage, SonarRuntime sonarRuntime) {
+ AnalysisMode analysisMode, SensorStorage sensorStorage, SonarRuntime sonarRuntime, InputModuleHierarchy hierarchy) {
this.module = module;
this.config = config;
this.mutableSettings = mutableSettings;
@@ -90,6 +92,7 @@ public class DefaultSensorContext implements SensorContext {
this.analysisMode = analysisMode;
this.sensorStorage = sensorStorage;
this.sonarRuntime = sonarRuntime;
+ this.hierarchy = hierarchy;
}
@Override
@@ -134,7 +137,7 @@ public class DefaultSensorContext implements SensorContext {
@Override
public NewIssue newIssue() {
- return new DefaultIssue(sensorStorage);
+ return new DefaultIssue(hierarchy.root(), sensorStorage);
}
@Override
@@ -142,7 +145,7 @@ public class DefaultSensorContext implements SensorContext {
if (analysisMode.isIssues()) {
return NO_OP_NEW_EXTERNAL_ISSUE;
}
- return new DefaultExternalIssue(sensorStorage);
+ return new DefaultExternalIssue(hierarchy.root(), sensorStorage);
}
@Override