aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2019-02-21 15:42:14 +0100
committerSonarTech <sonartech@sonarsource.com>2019-02-21 20:21:18 +0100
commit857c27b744321ddbdd7dbc12e761ee11b83e6288 (patch)
tree4eae0535df1e1a438c3cb727cc030c8cecaf1274 /sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor
parentc193b6d4082eea8bb8a96096456dd4183c2e4569 (diff)
downloadsonarqube-857c27b744321ddbdd7dbc12e761ee11b83e6288.tar.gz
sonarqube-857c27b744321ddbdd7dbc12e761ee11b83e6288.zip
SONAR-11670 Drop preview mode
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorContext.java5
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorContext.java35
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewAdHocRule.java69
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewCpdTokens.java49
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewExternalIssue.java96
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewHighlighting.java56
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewSignificantCode.java45
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewSymbolTable.java75
8 files changed, 3 insertions, 427 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorContext.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorContext.java
index d05cea7e914..76aa74d3bf0 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorContext.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ModuleSensorContext.java
@@ -21,7 +21,6 @@ package org.sonar.scanner.sensor;
import javax.annotation.concurrent.ThreadSafe;
import org.sonar.api.SonarRuntime;
-import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputModule;
import org.sonar.api.batch.fs.internal.DefaultInputProject;
@@ -36,8 +35,8 @@ public class ModuleSensorContext extends ProjectSensorContext {
private final InputModule module;
public ModuleSensorContext(DefaultInputProject project, InputModule module, Configuration config, Settings mutableSettings, FileSystem fs, ActiveRules activeRules,
- AnalysisMode analysisMode, SensorStorage sensorStorage, SonarRuntime sonarRuntime) {
- super(project, config, mutableSettings, fs, activeRules, analysisMode, sensorStorage, sonarRuntime);
+ SensorStorage sensorStorage, SonarRuntime sonarRuntime) {
+ super(project, config, mutableSettings, fs, activeRules, sensorStorage, sonarRuntime);
this.module = module;
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorContext.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorContext.java
index 3e06892cf84..0fe743dfbe2 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorContext.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/ProjectSensorContext.java
@@ -22,7 +22,6 @@ package org.sonar.scanner.sensor;
import java.io.Serializable;
import javax.annotation.concurrent.ThreadSafe;
import org.sonar.api.SonarRuntime;
-import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.InputModule;
@@ -54,42 +53,28 @@ import org.sonar.api.config.Configuration;
import org.sonar.api.config.Settings;
import org.sonar.api.scanner.fs.InputProject;
import org.sonar.api.utils.Version;
-import org.sonar.scanner.sensor.noop.NoOpNewAdHocRule;
import org.sonar.scanner.sensor.noop.NoOpNewAnalysisError;
-import org.sonar.scanner.sensor.noop.NoOpNewCpdTokens;
-import org.sonar.scanner.sensor.noop.NoOpNewExternalIssue;
-import org.sonar.scanner.sensor.noop.NoOpNewHighlighting;
-import org.sonar.scanner.sensor.noop.NoOpNewSignificantCode;
-import org.sonar.scanner.sensor.noop.NoOpNewSymbolTable;
@ThreadSafe
public class ProjectSensorContext implements SensorContext {
- static final NoOpNewHighlighting NO_OP_NEW_HIGHLIGHTING = new NoOpNewHighlighting();
- static final NoOpNewSymbolTable NO_OP_NEW_SYMBOL_TABLE = new NoOpNewSymbolTable();
- static final NoOpNewCpdTokens NO_OP_NEW_CPD_TOKENS = new NoOpNewCpdTokens();
static final NoOpNewAnalysisError NO_OP_NEW_ANALYSIS_ERROR = new NoOpNewAnalysisError();
- static final NoOpNewExternalIssue NO_OP_NEW_EXTERNAL_ISSUE = new NoOpNewExternalIssue();
- static final NoOpNewAdHocRule NO_OP_NEW_AD_HOC_RULE = new NoOpNewAdHocRule();
- static final NoOpNewSignificantCode NO_OP_NEW_SIGNIFICANT_CODE = new NoOpNewSignificantCode();
private final Settings mutableSettings;
private final FileSystem fs;
private final ActiveRules activeRules;
private final SensorStorage sensorStorage;
- private final AnalysisMode analysisMode;
private final DefaultInputProject project;
private final SonarRuntime sonarRuntime;
private final Configuration config;
public ProjectSensorContext(DefaultInputProject project, Configuration config, Settings mutableSettings, FileSystem fs, ActiveRules activeRules,
- AnalysisMode analysisMode, SensorStorage sensorStorage, SonarRuntime sonarRuntime) {
+ SensorStorage sensorStorage, SonarRuntime sonarRuntime) {
this.project = project;
this.config = config;
this.mutableSettings = mutableSettings;
this.fs = fs;
this.activeRules = activeRules;
- this.analysisMode = analysisMode;
this.sensorStorage = sensorStorage;
this.sonarRuntime = sonarRuntime;
}
@@ -146,33 +131,21 @@ public class ProjectSensorContext implements SensorContext {
@Override
public NewExternalIssue newExternalIssue() {
- if (analysisMode.isIssues()) {
- return NO_OP_NEW_EXTERNAL_ISSUE;
- }
return new DefaultExternalIssue(project, sensorStorage);
}
@Override
public NewAdHocRule newAdHocRule() {
- if (analysisMode.isIssues()) {
- return NO_OP_NEW_AD_HOC_RULE;
- }
return new DefaultAdHocRule(sensorStorage);
}
@Override
public NewHighlighting newHighlighting() {
- if (analysisMode.isIssues()) {
- return NO_OP_NEW_HIGHLIGHTING;
- }
return new DefaultHighlighting(sensorStorage);
}
@Override
public NewSymbolTable newSymbolTable() {
- if (analysisMode.isIssues()) {
- return NO_OP_NEW_SYMBOL_TABLE;
- }
return new DefaultSymbolTable(sensorStorage);
}
@@ -183,9 +156,6 @@ public class ProjectSensorContext implements SensorContext {
@Override
public NewCpdTokens newCpdTokens() {
- if (analysisMode.isIssues()) {
- return NO_OP_NEW_CPD_TOKENS;
- }
return new DefaultCpdTokens(sensorStorage);
}
@@ -212,9 +182,6 @@ public class ProjectSensorContext implements SensorContext {
@Override
public NewSignificantCode newSignificantCode() {
- if (analysisMode.isIssues()) {
- return NO_OP_NEW_SIGNIFICANT_CODE;
- }
return new DefaultSignificantCode(sensorStorage);
}
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewAdHocRule.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewAdHocRule.java
deleted file mode 100644
index 27e2f0d8ddd..00000000000
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewAdHocRule.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.scanner.sensor.noop;
-
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.batch.sensor.rule.NewAdHocRule;
-import org.sonar.api.rules.RuleType;
-
-public class NoOpNewAdHocRule implements NewAdHocRule {
-
- @Override
- public NoOpNewAdHocRule engineId(String engineId) {
- // no op
- return this;
- }
-
- @Override
- public NoOpNewAdHocRule ruleId(String ruleId) {
- // no op
- return this;
- }
-
- @Override
- public NewAdHocRule name(String name) {
- // no op
- return this;
- }
-
- @Override
- public NewAdHocRule description(String description) {
- // no op
- return this;
- }
-
- @Override
- public NoOpNewAdHocRule type(RuleType type) {
- // no op
- return this;
- }
-
- @Override
- public NoOpNewAdHocRule severity(Severity severity) {
- // no op
- return this;
- }
-
- @Override
- public void save() {
- // no op
- }
-
-}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewCpdTokens.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewCpdTokens.java
deleted file mode 100644
index f8dd9d8104d..00000000000
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewCpdTokens.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.scanner.sensor.noop;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-import org.sonar.api.batch.sensor.cpd.NewCpdTokens;
-
-public class NoOpNewCpdTokens implements NewCpdTokens {
- @Override
- public void save() {
- // Do nothing
- }
-
- @Override
- public NoOpNewCpdTokens onFile(InputFile inputFile) {
- // Do nothing
- return this;
- }
-
- @Override
- public NewCpdTokens addToken(TextRange range, String image) {
- // Do nothing
- return this;
- }
-
- @Override
- public NewCpdTokens addToken(int startLine, int startLineOffset, int endLine, int endLineOffset, String image) {
- // Do nothing
- return this;
- }
-}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewExternalIssue.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewExternalIssue.java
deleted file mode 100644
index ae12f7fb77c..00000000000
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewExternalIssue.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.scanner.sensor.noop;
-
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.batch.sensor.issue.NewExternalIssue;
-import org.sonar.api.batch.sensor.issue.NewIssueLocation;
-import org.sonar.api.batch.sensor.issue.internal.DefaultIssueLocation;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rules.RuleType;
-
-public class NoOpNewExternalIssue implements NewExternalIssue {
-
- @Override
- public NewExternalIssue forRule(RuleKey ruleKey) {
- // no op
- return this;
- }
-
- @Override
- public NewExternalIssue engineId(String engineId) {
- // no op
- return this;
- }
-
- @Override
- public NewExternalIssue ruleId(String ruleId) {
- // no op
- return this;
- }
-
- @Override
- public NewExternalIssue type(RuleType type) {
- // no op
- return this;
- }
-
- @Override
- public NewExternalIssue remediationEffortMinutes(Long effort) {
- // no op
- return this;
- }
-
- @Override
- public NewExternalIssue severity(Severity severity) {
- // no op
- return this;
- }
-
- @Override
- public NewExternalIssue at(NewIssueLocation primaryLocation) {
- // no op
- return this;
- }
-
- @Override
- public NewExternalIssue addLocation(NewIssueLocation secondaryLocation) {
- // no op
- return this;
- }
-
- @Override
- public NewExternalIssue addFlow(Iterable<NewIssueLocation> flowLocations) {
- // no op
- return this;
- }
-
- @Override
- public NewIssueLocation newLocation() {
- // no op
- return new DefaultIssueLocation();
- }
-
- @Override
- public void save() {
- // no op
- }
-
-}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewHighlighting.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewHighlighting.java
deleted file mode 100644
index 8eb72753f7b..00000000000
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewHighlighting.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.scanner.sensor.noop;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-import org.sonar.api.batch.sensor.highlighting.NewHighlighting;
-import org.sonar.api.batch.sensor.highlighting.TypeOfText;
-
-public class NoOpNewHighlighting implements NewHighlighting {
- @Override
- public void save() {
- // Do nothing
- }
-
- @Override
- public NoOpNewHighlighting onFile(InputFile inputFile) {
- // Do nothing
- return this;
- }
-
- @Override
- public NoOpNewHighlighting highlight(int startOffset, int endOffset, TypeOfText typeOfText) {
- // Do nothing
- return this;
- }
-
- @Override
- public NoOpNewHighlighting highlight(int startLine, int startLineOffset, int endLine, int endLineOffset, TypeOfText typeOfText) {
- // Do nothing
- return this;
- }
-
- @Override
- public NoOpNewHighlighting highlight(TextRange range, TypeOfText typeOfText) {
- // Do nothing
- return this;
- }
-}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewSignificantCode.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewSignificantCode.java
deleted file mode 100644
index 3a400ec50cd..00000000000
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewSignificantCode.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.scanner.sensor.noop;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-import org.sonar.api.batch.sensor.code.NewSignificantCode;
-
-public class NoOpNewSignificantCode implements NewSignificantCode {
-
- @Override
- public NewSignificantCode onFile(InputFile file) {
- // no op
- return this;
- }
-
- @Override
- public NewSignificantCode addRange(TextRange range) {
- // no op
- return this;
- }
-
- @Override
- public void save() {
- // no op
- }
-
-}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewSymbolTable.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewSymbolTable.java
deleted file mode 100644
index 0173e2a58d3..00000000000
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/noop/NoOpNewSymbolTable.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.scanner.sensor.noop;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-import org.sonar.api.batch.sensor.symbol.NewSymbol;
-import org.sonar.api.batch.sensor.symbol.NewSymbolTable;
-
-public class NoOpNewSymbolTable implements NewSymbolTable, NewSymbol {
- @Override
- public void save() {
- // Do nothing
- }
-
- @Override
- public NoOpNewSymbolTable onFile(InputFile inputFile) {
- // Do nothing
- return this;
- }
-
- @Override
- public NewSymbol newSymbol(int startOffset, int endOffset) {
- // Do nothing
- return this;
- }
-
- @Override
- public NewSymbol newSymbol(int startLine, int startLineOffset, int endLine, int endLineOffset) {
- // Do nothing
- return this;
- }
-
- @Override
- public NewSymbol newSymbol(TextRange range) {
- // Do nothing
- return this;
- }
-
- @Override
- public NewSymbol newReference(int startLine, int startLineOffset, int endLine, int endLineOffset) {
- // Do nothing
- return this;
- }
-
- @Override
- public NewSymbol newReference(int startOffset, int endOffset) {
- // Do nothing
- return this;
- }
-
- @Override
- public NewSymbol newReference(TextRange range) {
- // Do nothing
- return this;
- }
-
-}