/** * @return the config key the active rule belongs to */ public String getConfigKey() { return rule.getConfigKey(); }
/** * Create with all required fields */ public static Rule create(String repositoryKey, String key, String name) { return new Rule().setUniqueKey(repositoryKey, key).setName(name); }
@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); } }
@Override public RulesProfile createProfile(ValidationMessages validation) { RulesProfile profile1 = RulesProfile.create("Profile 1", "xoo"); profile1.activateRule(Rule.create("repo1", "defaultSeverity"), null); profile1.activateRule(Rule.create("repo1", "overrideSeverity"), RulePriority.CRITICAL); Rule ruleWithParam = Rule.create("repo1", "overrideParam"); ruleWithParam.setParams(Arrays.asList(new RuleParam(ruleWithParam, "param", "", ""))); ActiveRule arWithParam = profile1.activateRule(ruleWithParam, null); arWithParam.setParameter("param", "value"); return profile1; } }
@Override public Object clone() { return new ActiveRuleParam(getActiveRule(), getRuleParam(), getValue()); }
public Rule setUniqueKey(String repositoryKey, String key) { return setRepositoryKey(repositoryKey).setKey(key).setConfigKey(key); }
/** * @return the key of the active rule */ public String getRuleKey() { return rule.getKey(); }
public String getKey() { return ruleParam.getKey(); }
public ActiveRule setParameter(String key, String value) { RuleParam ruleParameter = rule.getParam(key); if (ruleParameter != null) { activeRuleParams.add(new ActiveRuleParam(this, ruleParameter, value)); } return this; }
public IssueDto setType(RuleType type) { this.type = type.getDbConstant(); return this; }
/** * Create with all required fields * * @since 2.10 */ public static Rule create(String repositoryKey, String key) { return new Rule().setUniqueKey(repositoryKey, key); }
public String getRepositoryKey() { return rule.getRepositoryKey(); }
public static Rule create() { return new Rule(); }
public static RulePriority valueOfInt(int ordinal) { return RulePriority.values()[ordinal]; } }
/** * Sets the rule name */ public Rule setName(String name) { this.name = removeNewLineCharacters(name); return this; }
@Override public Collection<Rule> findAll(RuleQuery query) { return delegate.findAll(query); }
public static RuleQuery create() { return new RuleQuery(); }
public RuleDefinitionDto setType(RuleType type) { this.type = type.getDbConstant(); return this; }