本文整理了Java中org.sonar.api.rules.Rule.setStatus
方法的一些代码示例,展示了Rule.setStatus
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rule.setStatus
方法的具体详情如下:
包路径:org.sonar.api.rules.Rule
类名称:Rule
方法名:setStatus
暂无
代码示例来源:origin: SonarSource/sonarqube
@Test
public void should_set_valid_status() {
Rule rule = Rule.create().setStatus(Rule.STATUS_DEPRECATED);
assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_DEPRECATED);
rule = Rule.create().setStatus(Rule.STATUS_REMOVED);
assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_REMOVED);
rule = Rule.create().setStatus(Rule.STATUS_BETA);
assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_BETA);
rule = Rule.create().setStatus(Rule.STATUS_READY);
assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_READY);
}
代码示例来源:origin: SonarSource/sonarqube
rule.setStatus(StringUtils.trim(cursor.collectDescendantText(false)));
代码示例来源:origin: SonarSource/sonarqube
@Test(expected = SonarException.class)
public void should_not_authorize_unkown_status() {
Rule.create().setStatus("Unknown");
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public List<Rule> createRules() {
Rule rule = Rule.create("checkstyle", "ConstantName", "Constant Name");
rule.setDescription("Checks that constant names conform to the specified format");
rule.setConfigKey("Checker/TreeWalker/ConstantName");
rule.setSeverity(RulePriority.BLOCKER);
rule.setStatus(Rule.STATUS_BETA);
rule.setTags(new String[] {"style", "clumsy"});
rule.createParameter("format").setDescription("Regular expression").setDefaultValue("A-Z").setType("REGULAR_EXPRESSION");
return Arrays.asList(rule);
}
}
代码示例来源:origin: SonarSource/sonarqube
private static Rule toRule(String repositoryKey, Class clazz, org.sonar.check.Rule ruleAnnotation) {
String ruleKey = StringUtils.defaultIfEmpty(ruleAnnotation.key(), clazz.getCanonicalName());
String ruleName = StringUtils.defaultIfEmpty(ruleAnnotation.name(), null);
String description = StringUtils.defaultIfEmpty(ruleAnnotation.description(), null);
Rule rule = Rule.create(repositoryKey, ruleKey, ruleName);
rule.setDescription(description);
rule.setSeverity(RulePriority.fromCheckPriority(ruleAnnotation.priority()));
rule.setCardinality(ruleAnnotation.cardinality());
rule.setStatus(ruleAnnotation.status());
rule.setTags(ruleAnnotation.tags());
List<Field> fields = FieldUtils2.getFields(clazz, true);
for (Field field : fields) {
addRuleProperty(rule, field);
}
return rule;
}
代码示例来源:origin: SonarSource/sonarqube
.setRepositoryKey(rule.getRepositoryKey())
.setSeverity(severity != null ? RulePriority.valueOf(severity) : null)
.setStatus(rule.getStatus().name())
.setSystemTags(rule.getSystemTags().toArray(new String[rule.getSystemTags().size()]))
.setTags(rule.getTags().toArray(new String[rule.getTags().size()]))
代码示例来源:origin: SonarSource/sonarqube
.setRepositoryKey(ruleDefinition.getRepositoryKey())
.setSeverity(severity != null ? RulePriority.valueOf(severity) : null)
.setStatus(ruleDefinition.getStatus().name())
.setSystemTags(ruleDefinition.getSystemTags().toArray(new String[ruleDefinition.getSystemTags().size()]))
.setTags(new String[0])
代码示例来源:origin: org.codehaus.sonar/sonar-deprecated
rule.setStatus(StringUtils.trim(cursor.collectDescendantText(false)));
代码示例来源:origin: org.sonarsource.sonarqube/sonar-plugin-api
private static Rule toRule(String repositoryKey, Class clazz, org.sonar.check.Rule ruleAnnotation) {
String ruleKey = StringUtils.defaultIfEmpty(ruleAnnotation.key(), clazz.getCanonicalName());
String ruleName = StringUtils.defaultIfEmpty(ruleAnnotation.name(), null);
String description = StringUtils.defaultIfEmpty(ruleAnnotation.description(), null);
Rule rule = Rule.create(repositoryKey, ruleKey, ruleName);
rule.setDescription(description);
rule.setSeverity(RulePriority.fromCheckPriority(ruleAnnotation.priority()));
rule.setCardinality(ruleAnnotation.cardinality());
rule.setStatus(ruleAnnotation.status());
rule.setTags(ruleAnnotation.tags());
List<Field> fields = FieldUtils2.getFields(clazz, true);
for (Field field : fields) {
addRuleProperty(rule, field);
}
return rule;
}
代码示例来源:origin: org.codehaus.sonar/sonar-deprecated
private Rule toRule(String repositoryKey, Class clazz, org.sonar.check.Rule ruleAnnotation) {
String ruleKey = StringUtils.defaultIfEmpty(ruleAnnotation.key(), clazz.getCanonicalName());
String ruleName = StringUtils.defaultIfEmpty(ruleAnnotation.name(), null);
String description = StringUtils.defaultIfEmpty(ruleAnnotation.description(), null);
Rule rule = Rule.create(repositoryKey, ruleKey, ruleName);
rule.setDescription(description);
rule.setSeverity(RulePriority.fromCheckPriority(ruleAnnotation.priority()));
rule.setCardinality(ruleAnnotation.cardinality());
rule.setStatus(ruleAnnotation.status());
rule.setTags(ruleAnnotation.tags());
List<Field> fields = FieldUtils2.getFields(clazz, true);
for (Field field : fields) {
addRuleProperty(rule, field);
}
return rule;
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-server
.setRepositoryKey(rule.getRepositoryKey())
.setSeverity(severity != null ? RulePriority.valueOf(severity) : null)
.setStatus(rule.getStatus().name())
.setSystemTags(rule.getSystemTags().toArray(new String[rule.getSystemTags().size()]))
.setTags(rule.getTags().toArray(new String[rule.getTags().size()]))
代码示例来源:origin: org.sonarsource.sonarqube/sonar-server
.setRepositoryKey(ruleDefinition.getRepositoryKey())
.setSeverity(severity != null ? RulePriority.valueOf(severity) : null)
.setStatus(ruleDefinition.getStatus().name())
.setSystemTags(ruleDefinition.getSystemTags().toArray(new String[ruleDefinition.getSystemTags().size()]))
.setTags(new String[0])
代码示例来源:origin: org.sonarsource.sonarqube/sonar-plugin-api
rule.setStatus(StringUtils.trim(cursor.collectDescendantText(false)));
内容来源于网络,如有侵权,请联系作者删除!