Пример #1
0
 /**
  * Note: disabled rules are excluded.
  *
  * @return the list of active rules for a given severity
  */
 public List<ActiveRule> getActiveRules(RulePriority severity) {
   List<ActiveRule> result = new ArrayList<>();
   for (ActiveRule activeRule : activeRules) {
     if (activeRule.getSeverity().equals(severity) && activeRule.isEnabled()) {
       result.add(activeRule);
     }
   }
   return result;
 }
Пример #2
0
 /**
  * Get the active rules of a specific repository. Only enabled rules are selected. Disabled rules
  * are excluded.
  */
 public List<ActiveRule> getActiveRulesByRepository(String repositoryKey) {
   List<ActiveRule> result = new ArrayList<>();
   for (ActiveRule activeRule : activeRules) {
     if (repositoryKey.equals(activeRule.getRepositoryKey()) && activeRule.isEnabled()) {
       result.add(activeRule);
     }
   }
   return result;
 }
Пример #3
0
 /** Note: disabled rules are excluded. */
 @CheckForNull
 public ActiveRule getActiveRuleByConfigKey(String repositoryKey, String configKey) {
   for (ActiveRule activeRule : activeRules) {
     if (StringUtils.equals(activeRule.getRepositoryKey(), repositoryKey)
         && StringUtils.equals(activeRule.getConfigKey(), configKey)
         && activeRule.isEnabled()) {
       return activeRule;
     }
   }
   return null;
 }
Пример #4
0
 /** @return the list of active rules */
 public List<ActiveRule> getActiveRules(boolean acceptDisabledRules) {
   if (acceptDisabledRules) {
     return activeRules;
   }
   List<ActiveRule> result = new ArrayList<>();
   for (ActiveRule activeRule : activeRules) {
     if (activeRule.isEnabled()) {
       result.add(activeRule);
     }
   }
   return result;
 }