private void processRule(final IFlexRule currentRule) { LOGGER.fine("Processing " + currentRule.getRuleName() + "..."); for (final Entry<String, IFlexFile> currentFileEntry : files.entrySet()) { processFile(currentRule, currentFileEntry.getValue()); } }
private void computeRules(final RuleSet ruleSet) { LOGGER.info("computing RulesList"); final long startTime = System.currentTimeMillis(); Set<String> excludes = new HashSet<String>(ruleSet.getExcludePatterns()); for (Rule rule : ruleSet.getRules()) { while (rule instanceof RuleReference) { excludes = ((RuleReference) rule).getRuleSetReference().getExcludes(); rule = ((RuleReference) rule).getRule(); } final IFlexRule flexRule = (IFlexRule) rule; if (excludes != null && !excludes.isEmpty()) { flexRule.setExcludes(excludes); } rules.put(flexRule.getRuleName(), flexRule); } LOGGER.info("computed RulesList in " + (System.currentTimeMillis() - startTime) + " ms"); }
private void processFile(final IFlexRule currentRule, final IFlexFile currentFile) { try { final String fullyQualifiedName = currentFile.getFullyQualifiedName(); final IPackage ast = currentRule instanceof IFlexAstRule ? asts.get(fullyQualifiedName) : null; final List<IFlexViolation> foundViolations = currentRule.processFile(currentFile, ast, files); if (!foundViolations.isEmpty()) { if (violations.containsKey(currentFile)) { violations.get(currentFile).addAll(foundViolations); } else { violations.put(currentFile, foundViolations); } } } catch (final Exception e) { LOGGER.warning(StackTraceUtils.print(currentFile.getFullyQualifiedName(), e)); } }