本文整理了Java中org.sonar.api.config.Settings.getDouble()
方法的一些代码示例,展示了Settings.getDouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getDouble()
方法的具体详情如下:
包路径:org.sonar.api.config.Settings
类名称:Settings
方法名:getDouble
[英]Effective value as Double.
[中]有效值为双倍。
代码示例来源:origin: SonarSource/sonarqube
newIssue
.forRule(ruleKey)
.gap(context.settings().getDouble(EFFORT_TO_FIX_PROPERTY))
.at(newIssue.newLocation()
.on(inputFile)
代码示例来源:origin: SonarSource/sonarqube
@Test
public void test_get_double() {
Settings settings = new MapSettings();
settings.setProperty("from_double", 3.14159);
settings.setProperty("from_string", "3.14159");
assertThat(settings.getDouble("from_double")).isEqualTo(3.14159, Offset.offset(0.00001));
assertThat(settings.getDouble("from_string")).isEqualTo(3.14159, Offset.offset(0.00001));
assertThat(settings.getDouble("unknown")).isNull();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void test_get_float() {
Settings settings = new MapSettings();
settings.setProperty("from_float", 3.14159f);
settings.setProperty("from_string", "3.14159");
assertThat(settings.getDouble("from_float")).isEqualTo(3.14159f, Offset.offset(0.00001));
assertThat(settings.getDouble("from_string")).isEqualTo(3.14159f, Offset.offset(0.00001));
assertThat(settings.getDouble("unknown")).isNull();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void testSetNullDouble() {
Settings settings = new MapSettings();
settings.setProperty("foo", (Double) null);
assertThat(settings.getDouble("foo")).isNull();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void test_get_bad_double() {
Settings settings = new MapSettings();
settings.setProperty("foo", "bar");
thrown.expect(IllegalStateException.class);
thrown.expectMessage("The property 'foo' is not a double value");
settings.getDouble("foo");
}
代码示例来源:origin: SonarSource/sonarqube
private void createIssues(InputFile file, SensorContext context, String repo) {
RuleKey ruleKey = RuleKey.of(repo, RULE_KEY);
String severity = context.settings().getString(FORCE_SEVERITY_PROPERTY);
for (int line = 1; line <= file.lines(); line++) {
NewIssue newIssue = context.newIssue();
newIssue
.forRule(ruleKey)
.at(newIssue.newLocation()
.on(file)
.at(file.selectLine(line))
.message("This issue is generated on each line"))
.overrideSeverity(severity != null ? Severity.valueOf(severity) : null);
if (context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(5, 5))) {
newIssue.gap(context.settings().getDouble(EFFORT_TO_FIX_PROPERTY));
} else {
newIssue.gap(context.settings().getDouble(EFFORT_TO_FIX_PROPERTY));
}
newIssue.save();
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-xoo-plugin
newIssue
.forRule(ruleKey)
.gap(context.settings().getDouble(EFFORT_TO_FIX_PROPERTY))
.at(newIssue.newLocation()
.on(inputFile)
代码示例来源:origin: org.sonarsource.sonarqube/sonar-xoo-plugin
private void createIssues(InputFile file, SensorContext context, String repo) {
RuleKey ruleKey = RuleKey.of(repo, RULE_KEY);
String severity = context.settings().getString(FORCE_SEVERITY_PROPERTY);
for (int line = 1; line <= file.lines(); line++) {
NewIssue newIssue = context.newIssue();
newIssue
.forRule(ruleKey)
.at(newIssue.newLocation()
.on(file)
.at(file.selectLine(line))
.message("This issue is generated on each line"))
.overrideSeverity(severity != null ? Severity.valueOf(severity) : null);
if (context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(5, 5))) {
newIssue.gap(context.settings().getDouble(EFFORT_TO_FIX_PROPERTY));
} else {
newIssue.gap(context.settings().getDouble(EFFORT_TO_FIX_PROPERTY));
}
newIssue.save();
}
}
代码示例来源:origin: org.codehaus.sonar.plugins/sonar-xoo-plugin
private void createIssues(InputFile file, SensorContext context) {
RuleKey ruleKey = RuleKey.of(XooRulesDefinition.XOO_REPOSITORY, RULE_KEY);
String severity = context.settings().getString(FORCE_SEVERITY_PROPERTY);
for (int line = 1; line <= file.lines(); line++) {
context.newIssue()
.forRule(ruleKey)
.onFile(file)
.atLine(line)
.effortToFix(context.settings().getDouble(EFFORT_TO_FIX_PROPERTY))
.overrideSeverity(severity != null ? Severity.valueOf(severity) : null)
.message("This issue is generated on each line")
.save();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!