private void validateConstraints(RuleSet ruleSet, String constraintPattern, Severity parentSeverity, Severity requestedSeverity) throws RuleException { List<Constraint> matchingConstraints = ruleSet.getConstraintBucket().match(constraintPattern); if (matchingConstraints.isEmpty()) { LOGGER.warn("Could not find constraints matching to '{}'.", constraintPattern); } else { for (Constraint matchingConstraint : matchingConstraints) { validateConstraint(ruleSet, matchingConstraint, getEffectiveSeverity(matchingConstraint, parentSeverity, requestedSeverity)); } } }
@Override public void write(RuleSet ruleSet, Writer writer) throws com.buschmais.jqassistant.core.analysis.api.rule.RuleException { CollectRulesVisitor visitor = new CollectRulesVisitor(); RuleSelection ruleSelection = RuleSelection.builder().groupIds(ruleSet.getGroupsBucket().getIds()) .constraintIds(ruleSet.getConstraintBucket().getIds()).conceptIds(ruleSet.getConceptBucket().getIds()).build(); new RuleSetExecutor(visitor, configuration).execute(ruleSet, ruleSelection); JqassistantRules rules = new JqassistantRules(); writeGroups(visitor.getGroups(), rules); writeConcepts(visitor.getConcepts().keySet(), rules); writeConstraints(visitor.getConstraints().keySet(), rules); marshal(writer, rules); }
/** * Logs the given rule set on level info. * * @param ruleSet * The rule set. */ public void printRuleSet(RuleSet ruleSet) throws RuleException { RuleSelection ruleSelection = RuleSelection.builder() .conceptIds(ruleSet.getConceptBucket().getIds()) .constraintIds(ruleSet.getConstraintBucket().getIds()) .groupIds(ruleSet.getGroupsBucket().getIds()).build(); printRuleSet(ruleSet, ruleSelection); }
for (Constraint constraint : ruleSet.getConstraintBucket().getAll()) { JSONObject constraintObject = new JSONObject(); constraintObject.put(JSON_OBJECT_KEY_ID, constraint.getId());