aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2017-01-27 18:17:20 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2017-01-30 09:13:30 +0100
commit96bfde91a0006ef4577acd0d35f83745ac7699e5 (patch)
tree7b632b3fba49bba129705ef0d04f3e48aed31e0e /sonar-scanner-engine
parentf78f06335e9c6def32e7a4e7bdba897d80eb839d (diff)
downloadsonarqube-96bfde91a0006ef4577acd0d35f83745ac7699e5.tar.gz
sonarqube-96bfde91a0006ef4577acd0d35f83745ac7699e5.zip
Improve quality and javadoc
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java11
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/DefaultPostJobContext.java8
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/report/CoveragePublisher.java8
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ConsoleReport.java8
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/IssuesReportBuilder.java10
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java2
6 files changed, 19 insertions, 28 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java
index 7316507aed4..e0fedca549f 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/AbstractPhaseExecutor.java
@@ -19,7 +19,6 @@
*/
package org.sonar.scanner.phases;
-
import org.sonar.api.batch.SensorContext;
import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.scanner.events.BatchStepEvent;
@@ -73,14 +72,13 @@ public abstract class AbstractPhaseExecutor {
initIssueExclusions();
sensorsExecutor.execute(sensorContext);
-
+
afterSensors();
if (module.definition().getParent() == null) {
executeOnRoot();
postJobsExecutor.execute(sensorContext);
}
- cleanMemory();
eventBus.fireEvent(new ProjectAnalysisEvent(module, false));
}
@@ -109,11 +107,4 @@ public abstract class AbstractPhaseExecutor {
initializersExecutor.execute();
fsLogger.log();
}
-
- private void cleanMemory() {
- String cleanMemory = "Clean memory";
- eventBus.fireEvent(new BatchStepEvent(cleanMemory, true));
- // index.clear();
- eventBus.fireEvent(new BatchStepEvent(cleanMemory, false));
- }
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/DefaultPostJobContext.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/DefaultPostJobContext.java
index 7f43c5ac313..a647c150cce 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/DefaultPostJobContext.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/DefaultPostJobContext.java
@@ -39,12 +39,12 @@ public class DefaultPostJobContext implements PostJobContext {
private final Settings settings;
private final IssueCache cache;
private final AnalysisMode analysisMode;
- private InputComponentStore inputComponentCache;
+ private InputComponentStore inputComponentStore;
- public DefaultPostJobContext(Settings settings, IssueCache cache, InputComponentStore inputComponentCache, AnalysisMode analysisMode) {
+ public DefaultPostJobContext(Settings settings, IssueCache cache, InputComponentStore inputComponentStore, AnalysisMode analysisMode) {
this.settings = settings;
this.cache = cache;
- this.inputComponentCache = inputComponentCache;
+ this.inputComponentStore = inputComponentStore;
this.analysisMode = analysisMode;
}
@@ -99,7 +99,7 @@ public class DefaultPostJobContext implements PostJobContext {
@Override
public InputComponent inputComponent() {
- return inputComponentCache.getByKey(wrapped.componentKey());
+ return inputComponentStore.getByKey(wrapped.componentKey());
}
@Override
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/CoveragePublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/CoveragePublisher.java
index c59e26f21f6..9e64e8469dd 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/CoveragePublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/CoveragePublisher.java
@@ -37,17 +37,17 @@ import org.sonar.scanner.scan.measure.MeasureCache;
public class CoveragePublisher implements ReportPublisherStep {
- private final InputComponentStore componentCache;
+ private final InputComponentStore componentStore;
private final MeasureCache measureCache;
- public CoveragePublisher(InputComponentStore componentCache, MeasureCache measureCache) {
- this.componentCache = componentCache;
+ public CoveragePublisher(InputComponentStore componentStore, MeasureCache measureCache) {
+ this.componentStore = componentStore;
this.measureCache = measureCache;
}
@Override
public void publish(ScannerReportWriter writer) {
- for (final DefaultInputFile inputFile : componentCache.allFilesToPublish()) {
+ for (final DefaultInputFile inputFile : componentStore.allFilesToPublish()) {
Map<Integer, LineCoverage.Builder> coveragePerLine = new LinkedHashMap<>();
int lineCount = inputFile.lines();
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ConsoleReport.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ConsoleReport.java
index 5dc8df42808..917e7e89669 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ConsoleReport.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/ConsoleReport.java
@@ -47,13 +47,13 @@ public class ConsoleReport implements Reporter {
private Settings settings;
private IssueCache issueCache;
- private InputComponentStore inputPathCache;
+ private InputComponentStore componentStore;
@VisibleForTesting
- public ConsoleReport(Settings settings, IssueCache issueCache, InputComponentStore inputPathCache) {
+ public ConsoleReport(Settings settings, IssueCache issueCache, InputComponentStore componentStore) {
this.settings = settings;
this.issueCache = issueCache;
- this.inputPathCache = inputPathCache;
+ this.componentStore = componentStore;
}
private static class Report {
@@ -100,7 +100,7 @@ public class ConsoleReport implements Reporter {
if (settings.getBoolean(CONSOLE_REPORT_ENABLED_KEY)) {
LOG.warn("Console report is deprecated. Use SonarLint CLI to have local reports of issues");
Report r = new Report();
- r.setNoFile(!inputPathCache.allFilesToPublish().iterator().hasNext());
+ r.setNoFile(!componentStore.allFilesToPublish().iterator().hasNext());
for (TrackedIssue issue : issueCache.all()) {
r.process(issue);
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/IssuesReportBuilder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/IssuesReportBuilder.java
index a711166fe7e..7aad80c57ba 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/IssuesReportBuilder.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/report/IssuesReportBuilder.java
@@ -42,23 +42,23 @@ public class IssuesReportBuilder {
private final IssueCache issueCache;
private final Rules rules;
- private final InputComponentStore inputComponentCache;
+ private final InputComponentStore inputComponentStore;
private final InputModuleHierarchy moduleHierarchy;
private final ProjectAnalysisInfo projectAnalysisInfo;
public IssuesReportBuilder(IssueCache issueCache, Rules rules, ProjectAnalysisInfo projectAnalysisInfo, InputModuleHierarchy moduleHierarchy,
- InputComponentStore inputComponentCache) {
+ InputComponentStore inputComponentStore) {
this.issueCache = issueCache;
this.rules = rules;
this.projectAnalysisInfo = projectAnalysisInfo;
this.moduleHierarchy = moduleHierarchy;
- this.inputComponentCache = inputComponentCache;
+ this.inputComponentStore = inputComponentStore;
}
public IssuesReport buildReport() {
DefaultInputModule project = moduleHierarchy.root();
IssuesReport issuesReport = new IssuesReport();
- issuesReport.setNoFile(!inputComponentCache.allFilesToPublish().iterator().hasNext());
+ issuesReport.setNoFile(!inputComponentStore.allFilesToPublish().iterator().hasNext());
issuesReport.setTitle(project.definition().getName());
issuesReport.setDate(projectAnalysisInfo.analysisDate());
@@ -71,7 +71,7 @@ public class IssuesReportBuilder {
for (TrackedIssue issue : issues) {
Rule rule = findRule(issue);
RulePriority severity = RulePriority.valueOf(issue.severity());
- InputComponent resource = inputComponentCache.getByKey(issue.componentKey());
+ InputComponent resource = inputComponentStore.getByKey(issue.componentKey());
if (!validate(issue, rule, resource)) {
continue;
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java
index 2159e09ad4f..e411c16b7cd 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java
@@ -113,7 +113,7 @@ public final class ScmPublisher {
return filesToBlame;
}
- private void askToCopyDataFromPreviousAnalysis(DefaultInputFile f, ScannerReportWriter writer) {
+ private static void askToCopyDataFromPreviousAnalysis(DefaultInputFile f, ScannerReportWriter writer) {
Builder scmBuilder = ScannerReport.Changesets.newBuilder();
scmBuilder.setComponentRef(f.batchId());
scmBuilder.setCopyFromPrevious(true);