private boolean activeRulesCondition(DefaultSensorDescriptor descriptor) { if (!descriptor.ruleRepositories().isEmpty()) { for (String repoKey : descriptor.ruleRepositories()) { if (!activeRules.findByRepository(repoKey).isEmpty()) { return true; } } return false; } return true; }
private boolean initAndAddIssue(DefaultIssue issue, @Nullable Violation violation) { RuleKey ruleKey = issue.ruleKey(); Rule rule = rules.find(ruleKey); validateRule(issue, rule); ActiveRule activeRule = activeRules.find(ruleKey); if (activeRule == null) { // rule does not exist or is not enabled -> ignore the issue return false; } updateIssue(issue, rule, activeRule); if (filters.accept(issue, violation)) { cache.put(issue); return true; } return false; }
/** @return null, if this check is inactive */ @CheckForNull public static ActiveRule getActiveRule(ActiveRules rules) { return rules.find(RuleKey.of(CheckList.REPOSITORY_KEY, RULE_KEY)); }