org.sonar.api.config.Settings.getInt()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.sonar.api.config.Settings.getInt()方法的一些代码示例,展示了Settings.getInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getInt()方法的具体详情如下:
包路径:org.sonar.api.config.Settings
类名称:Settings
方法名:getInt

Settings.getInt介绍

[英]Effective value as int.
[中]有效值为int。

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Test
public void default_number_values_are_zero() {
 Settings settings = new MapSettings();
 assertThat(settings.getInt("foo")).isEqualTo(0);
 assertThat(settings.getLong("foo")).isEqualTo(0L);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void set_property_int() {
 Settings settings = new MapSettings();
 settings.setProperty("foo", 123);
 assertThat(settings.getInt("foo")).isEqualTo(123);
 assertThat(settings.getString("foo")).isEqualTo("123");
 assertThat(settings.getBoolean("foo")).isFalse();
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void getInt_value_must_be_valid() {
 thrown.expect(NumberFormatException.class);
 Settings settings = new MapSettings();
 settings.setProperty("foo", "not a number");
 settings.getInt("foo");
}

代码示例来源:origin: AmadeusITGroup/sonar-stash

public int getStashTimeout() {
 return settings.getInt(StashPlugin.STASH_TIMEOUT);
}

代码示例来源:origin: AmadeusITGroup/sonar-stash

public Integer getPullRequestId() {
 return settings.getInt(StashPlugin.STASH_PULL_REQUEST_ID);
}

代码示例来源:origin: AmadeusITGroup/sonar-stash

public int getFilesLimitInOverview() {
 return settings.getInt(StashPlugin.STASH_FILES_LIMIT_IN_OVERVIEW);
}

代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api

private int hoursInDay() {
 return settings.getInt(CoreProperties.HOURS_IN_DAY);
}

代码示例来源:origin: SonarSource/sonar-github

public int pullRequestNumber() {
 return settings.getInt(GitHubPlugin.GITHUB_PULL_REQUEST);
}

代码示例来源:origin: AmadeusITGroup/sonar-stash

public int getIssueThreshold() {
 return settings.getInt(StashPlugin.STASH_ISSUE_THRESHOLD);
}

代码示例来源:origin: AmadeusITGroup/sonar-stash

public int issueVicinityRange() {
 return settings.getInt(StashPlugin.STASH_INCLUDE_VICINITY_RANGE);
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

@VisibleForTesting
int getMinimumTokens(String languageKey) {
 int minimumTokens = settings.getInt("sonar.cpd." + languageKey + ".minimumTokens");
 if (minimumTokens == 0) {
  minimumTokens = settings.getInt(CoreProperties.CPD_MINIMUM_TOKENS_PROPERTY);
 }
 if (minimumTokens == 0) {
  minimumTokens = 100;
 }
 return minimumTokens;
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch

@VisibleForTesting
/**
 * Not applicable to Java, as the {@link BlockChunker} that it uses does not record start and end units of each block. 
 * Also, it uses statements instead of tokens. 
 * @param languageKey
 * @return
 */
int getMinimumTokens(String languageKey) {
 int minimumTokens = settings.getInt("sonar.cpd." + languageKey + ".minimumTokens");
 if (minimumTokens == 0) {
  minimumTokens = 100;
 }
 return minimumTokens;
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

@VisibleForTesting
int getBlockSize(String languageKey) {
 int blockSize = settings.getInt("sonar.cpd." + languageKey + ".minimumLines");
 if (blockSize == 0) {
  blockSize = getDefaultBlockSize(languageKey);
 }
 return blockSize;
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch

@VisibleForTesting
int getBlockSize(String languageKey) {
 int blockSize = settings.getInt("sonar.cpd." + languageKey + ".minimumLines");
 if (blockSize == 0) {
  blockSize = getDefaultBlockSize(languageKey);
 }
 return blockSize;
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-db

static Date getDateFromWeeks(Settings settings, String propertyKey) {
 int weeks = settings.getInt(propertyKey);
 return DateUtils.addWeeks(new Date(), -weeks);
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-db

static Date getDateFromHours(Settings settings, String propertyKey) {
 int hours = settings.getInt(propertyKey);
 return DateUtils.addHours(new Date(), -hours);
}

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet/sonar-dotnet-plugin

/**
 * @see Settings#getInteger(String, Integer)
 */
public int getInt(String key) {
 int result = -1;
 // look if this key existed before
 String previousKey = (String) newToPreviousParamMap.get(key);
 if (StringUtils.isNotBlank(previousKey) && settings.hasKey(previousKey)) {
  result = settings.getInt(previousKey);
  // a former parameter has been specified, let's take this value
  logInfo(result, previousKey);
  return result;
 }
 // if this key wasn't used before, or if no value for was for it, use the value of the current key
 return settings.getInt(key);
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-db

public static PurgeConfiguration newDefaultPurgeConfiguration(Settings settings, IdUuidPair idUuidPair, Collection<String> disabledComponentUuids) {
 String[] scopes = new String[] {Scopes.FILE};
 if (settings.getBoolean(PurgeConstants.PROPERTY_CLEAN_DIRECTORY)) {
  scopes = new String[] {Scopes.DIRECTORY, Scopes.FILE};
 }
 return new PurgeConfiguration(idUuidPair, scopes, settings.getInt(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES), System2.INSTANCE, disabledComponentUuids);
}

代码示例来源:origin: Pablissimo/SonarTsPlugin

public static TsLintExecutorConfig fromSettings(Settings settings, SensorContext ctx, PathResolver resolver) {
  TsLintExecutorConfig toReturn = new TsLintExecutorConfig();
  toReturn.setPathToTsLint(resolver.getPath(ctx, TypeScriptPlugin.SETTING_TS_LINT_PATH, TSLINT_FALLBACK_PATH));
  toReturn.setConfigFile(resolver.getPath(ctx, TypeScriptPlugin.SETTING_TS_LINT_CONFIG_PATH, CONFIG_FILENAME));
  toReturn.setRulesDir(resolver.getPath(ctx, TypeScriptPlugin.SETTING_TS_LINT_RULES_DIR, null));
  toReturn.setPathToTsConfig(resolver.getPath(ctx, TypeScriptPlugin.SETTING_TS_LINT_PROJECT_PATH, null));
  toReturn.setPathToTsLintOutput(resolver.getPath(ctx, TypeScriptPlugin.SETTING_TS_LINT_OUTPUT_PATH, null));
  toReturn.setPathToNode(resolver.getPath(ctx, TypeScriptPlugin.SETTING_TS_LINT_NODE_PATH, NODE_FALLBACK_PATH));
  toReturn.setTimeoutMs(Math.max(5000, settings.getInt(TypeScriptPlugin.SETTING_TS_LINT_TIMEOUT)));
  toReturn.setShouldPerformTypeCheck(settings.getBoolean(TypeScriptPlugin.SETTING_TS_LINT_TYPECHECK));
  return toReturn;
}

代码示例来源:origin: org.codehaus.sonar.dotnet.fxcop/sonar-fxcop-library

rulesetFile, reportFile, settings.getInt(fxCopConf.timeoutPropertyKey()), settings.getBoolean(fxCopConf.aspnetPropertyKey()),
  splitOnCommas(settings.getString(fxCopConf.directoriesPropertyKey())), splitOnCommas(settings.getString(fxCopConf.referencesPropertyKey())));
} else {

相关文章