diff options
author | Julien HENRY <henryju@yahoo.fr> | 2017-07-05 09:33:58 +0200 |
---|---|---|
committer | Julien HENRY <henryju@yahoo.fr> | 2017-07-05 14:42:08 +0200 |
commit | cf0653f726df89776688bb25ca8a3b34dec685ec (patch) | |
tree | c97246d627ca521c21f2164e42ab6f036129c45d | |
parent | ccde391eea15c4e3661031778c8725c145845e48 (diff) | |
download | sonarqube-cf0653f726df89776688bb25ca8a3b34dec685ec.tar.gz sonarqube-cf0653f726df89776688bb25ca8a3b34dec685ec.zip |
Fix quality flaws
7 files changed, 10 insertions, 20 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtRemediationFunction.java index 96ff255364c..a0b2e24404d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtRemediationFunction.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtRemediationFunction.java @@ -27,6 +27,7 @@ import org.sonar.api.utils.Duration; * @since 4.3 * @deprecated since 6.5 debt model will soon be unavailable on batch side */ +@Deprecated public class DebtRemediationFunction { public enum Type { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobContext.java index cfe881f2866..d6255c82fc4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobContext.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobContext.java @@ -33,6 +33,7 @@ public interface PostJobContext { /** * @deprecated since 6.5 use {@link PostJobContext#config()} */ + @Deprecated Settings settings(); /** diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java index 8da60fb974e..cdf3aa304ac 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java @@ -36,8 +36,8 @@ import org.sonar.api.batch.sensor.issue.NewIssue; import org.sonar.api.batch.sensor.measure.Measure; import org.sonar.api.batch.sensor.measure.NewMeasure; import org.sonar.api.batch.sensor.symbol.NewSymbolTable; -import org.sonar.api.config.Settings; import org.sonar.api.config.Configuration; +import org.sonar.api.config.Settings; import org.sonar.api.utils.Version; /** @@ -50,6 +50,7 @@ public interface SensorContext { /** * @deprecated since 6.5 use {@link PostJobContext#config()} */ + @Deprecated Settings settings(); /** diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/DeprecatedSensorContext.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/DeprecatedSensorContext.java index 3679fa3fd1a..25439a3f923 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/DeprecatedSensorContext.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/DeprecatedSensorContext.java @@ -46,7 +46,8 @@ public class DeprecatedSensorContext extends DefaultSensorContext implements Sen private final DefaultIndex index; private final InputModule module; - public DeprecatedSensorContext(InputModule module, DefaultIndex index, Configuration config, org.sonar.api.config.Settings mutableSettings, FileSystem fs, ActiveRules activeRules, + public DeprecatedSensorContext(InputModule module, DefaultIndex index, Configuration config, org.sonar.api.config.Settings mutableSettings, + FileSystem fs, ActiveRules activeRules, AnalysisMode analysisMode, SensorStorage sensorStorage, SonarRuntime sonarRuntime) { super(module, config, mutableSettings, fs, activeRules, analysisMode, sensorStorage, sonarRuntime); this.index = index; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettingsProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettingsProvider.java index 7fd4d6a24d6..d17a9c0916f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettingsProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettingsProvider.java @@ -50,7 +50,7 @@ public class ModuleSettingsProvider extends ProviderAdapter { return projectSettings; } - private Map<String, String> addServerSidePropertiesIfModuleExists(ProjectRepositories projectRepos, ProjectDefinition def) { + private static Map<String, String> addServerSidePropertiesIfModuleExists(ProjectRepositories projectRepos, ProjectDefinition def) { if (projectRepos.moduleExists(def.getKeyWithBranch())) { return projectRepos.settings(def.getKeyWithBranch()); } else { @@ -63,7 +63,7 @@ public class ModuleSettingsProvider extends ProviderAdapter { } } - private void addScannerSideProperties(Map<String, String> settings, ProjectDefinition project) { + private static void addScannerSideProperties(Map<String, String> settings, ProjectDefinition project) { List<ProjectDefinition> orderedProjects = getTopDownParentProjects(project); for (ProjectDefinition p : orderedProjects) { settings.putAll(p.properties()); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableModuleSettings.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableModuleSettings.java index 8ae1bfb6ca4..da9caf1a825 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableModuleSettings.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableModuleSettings.java @@ -19,7 +19,6 @@ */ package org.sonar.scanner.scan; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -68,25 +67,12 @@ public class MutableModuleSettings extends Settings { } private void addBuildProperties(ProjectDefinition project) { - List<ProjectDefinition> orderedProjects = getTopDownParentProjects(project); + List<ProjectDefinition> orderedProjects = ModuleSettingsProvider.getTopDownParentProjects(project); for (ProjectDefinition p : orderedProjects) { addProperties(p.properties()); } } - /** - * From root to given project - */ - static List<ProjectDefinition> getTopDownParentProjects(ProjectDefinition project) { - List<ProjectDefinition> result = new ArrayList<>(); - ProjectDefinition p = project; - while (p != null) { - result.add(0, p); - p = p.getParent(); - } - return result; - } - @Override protected Optional<String> get(String key) { if (analysisMode.isIssues() && key.endsWith(".secured") && !key.contains(".license")) { diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java index f1a150d800f..c0e4d487632 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java @@ -76,7 +76,7 @@ public class MutableModuleSettingsTest { grandParent.addSubProject(parent); parent.addSubProject(child); - List<ProjectDefinition> hierarchy = MutableModuleSettings.getTopDownParentProjects(child); + List<ProjectDefinition> hierarchy = ModuleSettingsProvider.getTopDownParentProjects(child); assertThat(hierarchy.get(0)).isEqualTo(grandParent); assertThat(hierarchy.get(1)).isEqualTo(parent); assertThat(hierarchy.get(2)).isEqualTo(child); |