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 /sonar-scanner-engine | |
parent | ccde391eea15c4e3661031778c8725c145845e48 (diff) | |
download | sonarqube-cf0653f726df89776688bb25ca8a3b34dec685ec.tar.gz sonarqube-cf0653f726df89776688bb25ca8a3b34dec685ec.zip |
Fix quality flaws
Diffstat (limited to 'sonar-scanner-engine')
4 files changed, 6 insertions, 19 deletions
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); |