diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2018-11-13 16:27:39 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-01-16 09:42:59 +0100 |
commit | 0392f0dd841ffafde74d170918858fff43b22070 (patch) | |
tree | 5e1cd3e0678295a0906f26075a471f7191511b88 | |
parent | 4a659a05cf4ff177629e9cb78aa6a0721810ff61 (diff) | |
download | sonarqube-0392f0dd841ffafde74d170918858fff43b22070.tar.gz sonarqube-0392f0dd841ffafde74d170918858fff43b22070.zip |
Clean some scanner component names
16 files changed, 42 insertions, 43 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java index d206f91156e..8d26bed1a9a 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/AbstractPatternInitializer.java @@ -34,8 +34,8 @@ public abstract class AbstractPatternInitializer { private Configuration settings; private List<IssuePattern> multicriteriaPatterns; - protected AbstractPatternInitializer(Configuration settings) { - this.settings = settings; + protected AbstractPatternInitializer(Configuration config) { + this.settings = config; initPatterns(); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java index b4018c829c3..01e0ab76b06 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java @@ -40,7 +40,7 @@ public class IssueExclusionPatternInitializer extends AbstractPatternInitializer @Override protected String getMulticriteriaConfigurationKey() { - return "sonar.issue.ignore" + ".multicriteria"; + return IssueExclusionProperties.EXCLUSION_KEY_PREFIX + ".multicriteria"; } @Override diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializer.java index 164c90a317b..0fa72da96db 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueInclusionPatternInitializer.java @@ -20,6 +20,7 @@ package org.sonar.scanner.issue.ignore.pattern; import org.sonar.api.config.Configuration; +import org.sonar.core.config.IssueExclusionProperties; public class IssueInclusionPatternInitializer extends AbstractPatternInitializer { @@ -29,6 +30,6 @@ public class IssueInclusionPatternInitializer extends AbstractPatternInitializer @Override protected String getMulticriteriaConfigurationKey() { - return "sonar.issue.enforce" + ".multicriteria"; + return IssueExclusionProperties.INCLUSION_KEY_PREFIX + ".multicriteria"; } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfiguration.java index 3382fdf3e10..2dbcc577806 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleSettings.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfiguration.java @@ -25,9 +25,9 @@ import org.sonar.api.config.PropertyDefinitions; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.config.DefaultConfiguration; -public class ModuleSettings extends DefaultConfiguration { +public class ModuleConfiguration extends DefaultConfiguration { - public ModuleSettings(PropertyDefinitions propertyDefinitions, Encryption encryption, GlobalAnalysisMode mode, Map<String, String> props) { + public ModuleConfiguration(PropertyDefinitions propertyDefinitions, Encryption encryption, GlobalAnalysisMode mode, Map<String, String> props) { super(propertyDefinitions, encryption, mode, props); } 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/ModuleConfigurationProvider.java index a5ce21f2d30..f078a0d11be 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/ModuleConfigurationProvider.java @@ -32,23 +32,23 @@ import org.sonar.scanner.bootstrap.GlobalConfiguration; import org.sonar.scanner.report.AnalysisContextReportPublisher; import org.sonar.scanner.repository.ProjectRepositories; -public class ModuleSettingsProvider extends ProviderAdapter { +public class ModuleConfigurationProvider extends ProviderAdapter { - private ModuleSettings projectSettings; + private ModuleConfiguration moduleConfiguration; - public ModuleSettings provide(GlobalConfiguration globalSettings, DefaultInputModule module, ProjectRepositories projectRepos, - GlobalAnalysisMode analysisMode, AnalysisContextReportPublisher contextReportPublisher) { - if (projectSettings == null) { + public ModuleConfiguration provide(GlobalConfiguration globalConfig, DefaultInputModule module, ProjectRepositories projectRepos, + GlobalAnalysisMode analysisMode, AnalysisContextReportPublisher contextReportPublisher) { + if (moduleConfiguration == null) { Map<String, String> settings = new LinkedHashMap<>(); - settings.putAll(globalSettings.getProperties()); + settings.putAll(globalConfig.getProperties()); settings.putAll(addServerSidePropertiesIfModuleExists(projectRepos, module.definition())); addScannerSideProperties(settings, module.definition()); contextReportPublisher.dumpModuleSettings(module); - projectSettings = new ModuleSettings(globalSettings.getDefinitions(), globalSettings.getEncryption(), analysisMode, settings); + moduleConfiguration = new ModuleConfiguration(globalConfig.getDefinitions(), globalConfig.getEncryption(), analysisMode, settings); } - return projectSettings; + return moduleConfiguration; } private static Map<String, String> addServerSidePropertiesIfModuleExists(ProjectRepositories projectRepos, ProjectDefinition def) { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java index 68bd4a0ffdf..aa12cc96b7f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java @@ -89,7 +89,7 @@ public class ModuleScanContainer extends ComponentContainer { module.definition(), module, MutableModuleSettings.class, - new ModuleSettingsProvider()); + new ModuleConfigurationProvider()); if (analysisMode.isIssues()) { add( 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 b8daf815dba..d4a87b31e40 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 @@ -33,7 +33,7 @@ import org.sonar.scanner.repository.ProjectRepositories; import static java.util.Objects.requireNonNull; /** - * @deprecated since 6.5 {@link ModuleSettings} used to be mutable, so keep a mutable copy for backward compatibility. + * @deprecated since 6.5 {@link ModuleConfiguration} used to be mutable, so keep a mutable copy for backward compatibility. */ @Deprecated public class MutableModuleSettings extends Settings { @@ -69,7 +69,7 @@ public class MutableModuleSettings extends Settings { } private void addBuildProperties(ProjectDefinition project) { - List<ProjectDefinition> orderedProjects = ModuleSettingsProvider.getTopDownParentProjects(project); + List<ProjectDefinition> orderedProjects = ModuleConfigurationProvider.getTopDownParentProjects(project); for (ProjectDefinition p : orderedProjects) { addProperties(p.properties()); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableProjectSettings.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableProjectSettings.java index 3b17bd91f29..c09c844a095 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableProjectSettings.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/MutableProjectSettings.java @@ -32,7 +32,7 @@ import org.sonar.scanner.repository.ProjectRepositories; import static java.util.Objects.requireNonNull; /** - * @deprecated since 6.5 {@link ProjectSettings} used to be mutable, so keep a mutable copy for backward compatibility. + * @deprecated since 6.5 {@link ProjectConfiguration} used to be mutable, so keep a mutable copy for backward compatibility. */ @Deprecated public class MutableProjectSettings extends Settings { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettings.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfiguration.java index 6c60803e8cc..53a727b50e4 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettings.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfiguration.java @@ -25,9 +25,9 @@ import org.sonar.api.config.PropertyDefinitions; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.config.DefaultConfiguration; -public class ProjectSettings extends DefaultConfiguration { +public class ProjectConfiguration extends DefaultConfiguration { - public ProjectSettings(PropertyDefinitions propertyDefinitions, Encryption encryption, GlobalAnalysisMode mode, Map<String, String> props) { + public ProjectConfiguration(PropertyDefinitions propertyDefinitions, Encryption encryption, GlobalAnalysisMode mode, Map<String, String> props) { super(propertyDefinitions, encryption, mode, props); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettingsProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfigurationProvider.java index 918af7b0311..51041627d70 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectSettingsProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectConfigurationProvider.java @@ -27,20 +27,20 @@ import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.bootstrap.GlobalConfiguration; import org.sonar.scanner.repository.ProjectRepositories; -public class ProjectSettingsProvider extends ProviderAdapter { +public class ProjectConfigurationProvider extends ProviderAdapter { - private ProjectSettings projectSettings; + private ProjectConfiguration projectConfig; - public ProjectSettings provide(ProjectReactor reactor, GlobalConfiguration globalSettings, ProjectRepositories projectRepositories, GlobalAnalysisMode mode) { - if (projectSettings == null) { + public ProjectConfiguration provide(ProjectReactor reactor, GlobalConfiguration globalSettings, ProjectRepositories projectRepositories, GlobalAnalysisMode mode) { + if (projectConfig == null) { Map<String, String> settings = new LinkedHashMap<>(); settings.putAll(globalSettings.getProperties()); settings.putAll(projectRepositories.settings(reactor.getRoot().getKeyWithBranch())); settings.putAll(reactor.getRoot().properties()); - projectSettings = new ProjectSettings(globalSettings.getDefinitions(), globalSettings.getEncryption(), mode, settings); + projectConfig = new ProjectConfiguration(globalSettings.getDefinitions(), globalSettings.getEncryption(), mode, settings); } - return projectSettings; + return projectConfig; } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java index 0171e117e5f..5b9f43f3638 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java @@ -119,8 +119,8 @@ public class ProjectScanContainer extends ComponentContainer { @Override protected void doBeforeStart() { - addBatchComponents(); - addBatchExtensions(); + addScannerComponents(); + addScannerExtensions(); ProjectLock lock = getComponentByType(ProjectLock.class); lock.tryLock(); getComponentByType(WorkDirectoriesInitializer.class).execute(); @@ -133,7 +133,7 @@ public class ProjectScanContainer extends ComponentContainer { } - private void addBatchComponents() { + private void addScannerComponents() { add( props, ProjectReactorBuilder.class, @@ -202,7 +202,7 @@ public class ProjectScanContainer extends ComponentContainer { MutableProjectSettings.class, ScannerProperties.class, - new ProjectSettingsProvider(), + new ProjectConfigurationProvider(), // Report ScannerMetrics.class, @@ -252,15 +252,15 @@ public class ProjectScanContainer extends ComponentContainer { return getComponentByType(GlobalAnalysisMode.class).isIssues(); } - private void addBatchExtensions() { + private void addScannerExtensions() { getComponentByType(CoreExtensionsInstaller.class) - .install(this, noExtensionFilter(), extension -> isInstantiationStrategy(extension, PER_BATCH)); + .install(this, noExtensionFilter(), extension -> getScannerProjectExtensionsFilter().accept(extension)); getComponentByType(ExtensionInstaller.class) - .install(this, getBatchPluginExtensionsFilter()); + .install(this, getScannerProjectExtensionsFilter()); } @VisibleForTesting - static ExtensionMatcher getBatchPluginExtensionsFilter() { + static ExtensionMatcher getScannerProjectExtensionsFilter() { return extension -> isScannerSide(extension) || (isDeprecatedScannerSide(extension) && isInstantiationStrategy(extension, PER_BATCH)); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationProvider.java index 0e0f827a5be..a1c78fc65dd 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfigurationProvider.java @@ -56,7 +56,7 @@ public class BranchConfigurationProvider extends ProviderAdapter { } private static Supplier<Map<String, String>> createSettingsSupplier(GlobalConfiguration globalConfiguration, ProjectDefinition root, SettingsLoader settingsLoader) { - // we can't get ProjectSettings because it creates a circular dependency. + // we can't get ProjectConfiguration because it creates a circular dependency. // We create our own settings which will only be loaded if needed. return () -> { Map<String, String> settings = new HashMap<>(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java index ce394b9ffe3..4baae856d69 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageSensorTest.java @@ -30,7 +30,7 @@ import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.config.DefaultConfiguration; -import org.sonar.scanner.scan.ProjectSettings; +import org.sonar.scanner.scan.ProjectConfiguration; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -49,7 +49,7 @@ public class GenericCoverageSensorTest { settings.put(GenericCoverageSensor.OLD_OVERALL_COVERAGE_REPORT_PATHS_PROPERTY_KEY, "old5.xml,old6.xml"); PropertyDefinitions defs = new PropertyDefinitions(GenericCoverageSensor.properties()); - DefaultConfiguration config = new ProjectSettings(defs, new Encryption(null), mock(GlobalAnalysisMode.class), settings); + DefaultConfiguration config = new ProjectConfiguration(defs, new Encryption(null), mock(GlobalAnalysisMode.class), settings); Set<String> reportPaths = new GenericCoverageSensor(config).loadReportPaths(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java index 35bc5e3c435..739532a9d2c 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericTestExecutionSensorTest.java @@ -31,14 +31,12 @@ import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.sensor.internal.SensorContextTester; import org.sonar.api.config.Encryption; import org.sonar.api.config.PropertyDefinitions; -import org.sonar.api.config.Settings; -import org.sonar.api.config.internal.MapSettings; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.config.DefaultConfiguration; import org.sonar.scanner.deprecated.test.TestPlanBuilder; -import org.sonar.scanner.scan.ProjectSettings; +import org.sonar.scanner.scan.ProjectConfiguration; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -61,7 +59,7 @@ public class GenericTestExecutionSensorTest { Map<String, String> settings = new HashMap<>(); settings.put(GenericTestExecutionSensor.OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY, "report.xml"); PropertyDefinitions defs = new PropertyDefinitions(GenericTestExecutionSensor.properties()); - DefaultConfiguration config = new ProjectSettings(defs, new Encryption(null), mock(GlobalAnalysisMode.class), settings); + DefaultConfiguration config = new ProjectConfiguration(defs, new Encryption(null), mock(GlobalAnalysisMode.class), settings); new GenericTestExecutionSensor(mock(TestPlanBuilder.class), config).execute(context); assertThat(logTester.logs(LoggerLevel.WARN)).contains( 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 3cecb07c120..86be7dfda58 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 = ModuleSettingsProvider.getTopDownParentProjects(child); + List<ProjectDefinition> hierarchy = ModuleConfigurationProvider.getTopDownParentProjects(child); assertThat(hierarchy.get(0)).isEqualTo(grandParent); assertThat(hierarchy.get(1)).isEqualTo(parent); assertThat(hierarchy.get(2)).isEqualTo(child); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java index dfb191031ce..f9738b93d56 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectScanContainerTest.java @@ -32,7 +32,7 @@ public class ProjectScanContainerTest { @Test public void should_add_only_batch_extensions() { - ExtensionMatcher filter = ProjectScanContainer.getBatchPluginExtensionsFilter(); + ExtensionMatcher filter = ProjectScanContainer.getScannerProjectExtensionsFilter(); assertThat(filter.accept(new MyBatchExtension())).isTrue(); assertThat(filter.accept(MyBatchExtension.class)).isTrue(); |