diff options
author | Michal Duda <michal.duda@sonarsource.com> | 2018-11-29 15:37:02 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-01-16 09:43:03 +0100 |
commit | e05aea1ebbba8d94c78afdbfac7230563d6df01f (patch) | |
tree | 94d5175f301113f9f22d3c0a52e6a839ea1f3572 /sonar-scanner-engine/src | |
parent | 3b6dc9900be7384ada98426435704f8198df2948 (diff) | |
download | sonarqube-e05aea1ebbba8d94c78afdbfac7230563d6df01f.tar.gz sonarqube-e05aea1ebbba8d94c78afdbfac7230563d6df01f.zip |
SONAR-11525 analysis warning on module-lvl props
Analysis now produces a warning when the property that aggregates all previous module-level properties is not cleared.
Diffstat (limited to 'sonar-scanner-engine/src')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java index 2a85f416445..88f20ae9772 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java @@ -20,17 +20,31 @@ package org.sonar.scanner.scan; import java.util.Map; +import org.apache.commons.lang.StringUtils; import org.picocontainer.injectors.ProviderAdapter; +import org.sonar.api.CoreProperties; +import org.sonar.api.notifications.AnalysisWarnings; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; import org.sonar.scanner.bootstrap.ScannerProperties; import org.sonar.scanner.repository.settings.SettingsLoader; public class ProjectServerSettingsProvider extends ProviderAdapter { - private ProjectServerSettings singleton; + private static final Logger LOG = Loggers.get(ProjectConfigurationProvider.class); - public ProjectServerSettings provide(SettingsLoader loader, ScannerProperties scannerProperties) { + private static final String MODULE_LEVEL_ARCHIVED_SETTINGS_WARNING = "Please migrate all the properties listed in " + + "`sonar.module.removedProperties` setting to appriopriate project level setting."; + + private ProjectServerSettings singleton = null; + + public ProjectServerSettings provide(SettingsLoader loader, ScannerProperties scannerProperties, AnalysisWarnings analysisWarnings) { if (singleton == null) { Map<String, String> serverSideSettings = loader.load(scannerProperties.getKeyWithBranch()); + if (StringUtils.isNotBlank(serverSideSettings.get(CoreProperties.MODULE_LEVEL_ARCHIVED_SETTINGS))) { + LOG.warn(MODULE_LEVEL_ARCHIVED_SETTINGS_WARNING); + analysisWarnings.addUnique(MODULE_LEVEL_ARCHIVED_SETTINGS_WARNING); + } singleton = new ProjectServerSettings(serverSideSettings); } return singleton; |