本文整理了Java中org.sonar.api.config.Configuration.hasKey()
方法的一些代码示例,展示了Configuration.hasKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.hasKey()
方法的具体详情如下:
包路径:org.sonar.api.config.Configuration
类名称:Configuration
方法名:hasKey
暂无
代码示例来源:origin: SonarSource/sonarqube
private boolean settingsCondition(DefaultPostJobDescriptor descriptor) {
if (!descriptor.properties().isEmpty()) {
for (String propertyKey : descriptor.properties()) {
if (!settings.hasKey(propertyKey)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void describe(SensorDescriptor descriptor) {
descriptor
.name("Global Sensor")
.onlyWhenConfiguration(c -> c.hasKey(ENABLE_PROP));
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void describe(SensorDescriptor descriptor) {
descriptor.name("Import external issues report")
.onlyWhenConfiguration(c -> c.hasKey(REPORT_PATHS_PROPERTY_KEY));
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void describe(SensorDescriptor descriptor) {
descriptor.name("Generic Test Executions Report")
.global()
.onlyWhenConfiguration(conf -> conf.hasKey(REPORT_PATHS_PROPERTY_KEY));
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void describe(SensorDescriptor descriptor) {
descriptor
.name("Deprecated Global Sensor")
.global()
.onlyWhenConfiguration(c -> c.hasKey(ENABLE_PROP));
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void start() {
if (analysisMode.isIssues()) {
return;
}
if (isDisabled()) {
LOG.debug(MESSAGE_SCM_STEP_IS_DISABLED_BY_CONFIGURATION);
return;
}
if (settings.hasKey(SCM_PROVIDER_KEY)) {
settings.get(SCM_PROVIDER_KEY).ifPresent(this::setProviderIfSupported);
} else {
autodetection();
if (this.provider == null) {
considerOldScmUrl();
}
if (this.provider == null) {
String message = "SCM provider autodetection failed. Please use \"" + SCM_PROVIDER_KEY + "\" to define SCM of " +
"your project, or disable the SCM Sensor in the project settings.";
LOG.warn(message);
analysisWarnings.addUnique(message);
}
}
if (isExclusionDisabled()) {
LOG.info(MESSAGE_SCM_EXLUSIONS_IS_DISABLED_BY_CONFIGURATION);
}
}
代码示例来源:origin: SonarSource/sonar-java
protected void collect(SensorContext context, List<File> reportsDirs) {
LOGGER.info("parsing {}", reportsDirs);
surefireJavaParser.collect(context, reportsDirs,
settings.hasKey(SurefireUtils.SUREFIRE_REPORT_PATHS_PROPERTY) || settings.hasKey(SurefireUtils.SUREFIRE_REPORTS_PATH_PROPERTY));
}
代码示例来源:origin: SonarSource/sonar-java
private static void warnUsageOfDeprecatedProperty(Configuration settings, String reportPathProperty) {
if (!settings.hasKey(REPORT_PATHS_PROPERTY)) {
LOG.warn("Property '{}' is deprecated. Please use '{}' instead.", reportPathProperty, REPORT_PATHS_PROPERTY);
}
}
代码示例来源:origin: org.sonarsource.java/java-surefire
protected void collect(SensorContext context, List<File> reportsDirs) {
LOGGER.info("parsing {}", reportsDirs);
surefireJavaParser.collect(context, reportsDirs,
settings.hasKey(SurefireUtils.SUREFIRE_REPORT_PATHS_PROPERTY) || settings.hasKey(SurefireUtils.SUREFIRE_REPORTS_PATH_PROPERTY));
}
代码示例来源:origin: SonarSource/sonar-java
@CheckForNull
private static List<File> getReportsDirectoriesFromProperty(Configuration settings, FileSystem fs, PathResolver pathResolver) {
if(settings.hasKey(SUREFIRE_REPORT_PATHS_PROPERTY)) {
return Arrays.stream(settings.getStringArray(SUREFIRE_REPORT_PATHS_PROPERTY))
.map(String::trim)
.map(path -> getFileFromPath(fs, pathResolver, path))
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
return null;
}
代码示例来源:origin: SonarSource/sonar-java
@CheckForNull
private static File getReportsDirectoryFromDeprecatedProperty(Configuration settings, FileSystem fs, PathResolver pathResolver) {
if(settings.hasKey(SUREFIRE_REPORTS_PATH_PROPERTY)) {
String path = settings.get(SUREFIRE_REPORTS_PATH_PROPERTY).orElse(null);
if (path != null) {
return getFileFromPath(fs, pathResolver, path);
}
}
return null;
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-engine
private boolean settingsCondition(DefaultPostJobDescriptor descriptor) {
if (!descriptor.properties().isEmpty()) {
for (String propertyKey : descriptor.properties()) {
if (!settings.hasKey(propertyKey)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: org.sonarsource.python/sonar-python-plugin
private void warnIgnoredPropertyUsage(Configuration config, String ignoredKey) {
if (config.hasKey(ignoredKey)) {
String message = String.format("Property '%s' has been removed. Please use 'sonar.python.coverage.reportPaths' instead.", ignoredKey);
LOG.warn(message);
analysisWarnings.addWarning(message);
}
}
代码示例来源:origin: SonarSource/sonar-java
@Override
public void describe(SensorDescriptor descriptor) {
descriptor
.onlyWhenConfiguration(conf -> conf.hasKey(REPORT_PROPERTY_KEY))
.name("Import of PMD issues");
}
代码示例来源:origin: SonarSource/SonarJS
@Override
public void describe(SensorDescriptor sensorDescriptor) {
sensorDescriptor
.onlyWhenConfiguration(conf -> conf.hasKey(ESLINT_REPORT_PATHS))
.name("Import of " + LINTER_NAME + " issues");
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-xoo-plugin
@Override
public void describe(SensorDescriptor descriptor) {
descriptor
.name("Global Sensor")
.onlyWhenConfiguration(c -> c.hasKey(ENABLE_PROP));
}
代码示例来源:origin: SonarSource/sonar-java
@Override
public void describe(SensorDescriptor descriptor) {
descriptor
.onlyOnLanguage(CheckstyleSensor.LANGUAGE_KEY)
.onlyWhenConfiguration(conf -> conf.hasKey(REPORT_PROPERTY_KEY))
.name("Import of Checkstyle issues");
}
代码示例来源:origin: org.sonarsource.python/sonar-python-plugin
@Override
public void describe(SensorDescriptor descriptor) {
super.describe(descriptor);
descriptor
.createIssuesForRuleRepository(PylintRuleRepository.REPOSITORY_KEY)
.onlyWhenConfiguration(conf -> conf.hasKey(REPORT_PATH_KEY));
}
代码示例来源:origin: SonarSource/sonar-java
@Override
public void describe(SensorDescriptor descriptor) {
descriptor
.onlyOnLanguage(SpotBugsSensor.LANGUAGE_KEY)
.onlyWhenConfiguration(conf -> conf.hasKey(REPORT_PROPERTY_KEY))
.name("Import of SpotBugs issues");
}
代码示例来源:origin: SonarSource/SonarJS
@Override
public void describe(SensorDescriptor descriptor) {
descriptor
.onlyOnLanguage(JavaScriptLanguage.KEY)
.onlyWhenConfiguration(conf -> conf.hasKey(JavaScriptPlugin.LCOV_REPORT_PATHS))
.name("SonarJS Coverage")
.onlyOnFileType(Type.MAIN);
}
内容来源于网络,如有侵权,请联系作者删除!