rule.setDescription(StringUtils.trim(cursor.collectDescendantText(false)));
@Test public void description_should_be_cleaned() { Rule rule = Rule.create().setDescription(" my description "); Assert.assertEquals("my description", rule.getDescription()); rule.setDescription(null); assertThat(rule.getDescription()).isNull(); }
if (description != null && descriptionFormat != null) { if (RuleDto.Format.HTML.equals(descriptionFormat)) { apiRule.setDescription(description); } else { apiRule.setDescription(Markdown.convertToHtml(description));
if (description != null && descriptionFormat != null) { if (RuleDto.Format.HTML.equals(descriptionFormat)) { apiRule.setDescription(description); } else { apiRule.setDescription(Markdown.convertToHtml(description));
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; }
@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); } }
previousLine); if (index > 0) { rule.setDescription(rule.getDescription().substring(0, index)); } else if (line.matches("Summary:.*")) { inDescription = true; rule.setDescription(line.substring(line.indexOf(':') + 1)); } else if (line.matches("Category:.*")) { inDescription = true; if (inDescription) { line = ruleDescriptionLink(line); rule.setDescription(rule.getDescription() + "<br>" + line);
rule.setDescription(StringUtils.trim(cursor.collectDescendantText(false)));
public static Rule createRule(String repositoryKey, Class clazz, org.sonar.check.Rule ruleAnnotation, @Nullable RuleTags ruleTagsAnnotation) { 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()); setTags(rule, ruleTagsAnnotation); Field[] fields = clazz.getDeclaredFields(); if (fields != null) { for (Field field : fields) { addRuleProperty(rule, field); } } return rule; }
if (description != null && descriptionFormat != null) { if (RuleDto.Format.HTML.equals(descriptionFormat)) { apiRule.setDescription(description); } else { apiRule.setDescription(Markdown.convertToHtml(description));
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; }
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; }
if (description != null && descriptionFormat != null) { if (RuleDto.Format.HTML.equals(descriptionFormat)) { apiRule.setDescription(description); } else { apiRule.setDescription(Markdown.convertToHtml(description));
private static Rule createRepositoryRule(DelphiRule fRule) { RulePriority priority = severityFromLevel(fRule.getPriority()); Rule rule = Rule.create(DelphiPmdConstants.REPOSITORY_KEY, fRule.getName(), fRule.getMessage()).setSeverity( priority); rule.setDescription(fRule.getDescription()); rule.setTags(fRule.getTags()); rule.setConfigKey(fRule.getClazz()); List<RuleParam> ruleParams = new ArrayList<RuleParam>(); if (fRule.getProperties() != null) { for (Property property : fRule.getProperties()) { RuleParam param = rule.createParameter() .setKey(property.getName()) .setDescription(property.getName()) .setType("s"); if (NumberUtils.isNumber(property.getValue())) { param.setType("i"); } param.setDefaultValue(property.getValue()); ruleParams.add(param); } } rule.setParams(ruleParams); return rule; }
rule.setDescription(StringUtils.trim(cursor.collectDescendantText(false)));