Additional fixing to get exclude-pattern to work with multiple RuleSets.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6178 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Ryan Gustafson 2008-06-04 05:04:43 +00:00
parent 8534a438a6
commit 791e3f10e4
2 changed files with 5 additions and 1 deletions

View File

@ -88,6 +88,7 @@ public class PMD {
public void processFile(Reader reader, RuleSets ruleSets, RuleContext ctx,
SourceType sourceType) throws PMDException {
try {
// Coarse check to see if any RuleSet applies to files, will need to do a finer RuleSet specific check later
if (ruleSets.applies(ctx.getSourceCodeFile())) {
SourceTypeHandler sourceTypeHandler = SourceTypeHandlerBroker.getVisitorsFactoryForSourceType(sourceType);
ctx.setSourceType(sourceType);

View File

@ -133,7 +133,10 @@ public class RuleSets {
ruleChain.apply(acuList, ctx, language);
for (RuleSet ruleSet: ruleSets) {
if (applies(language, ruleSet.getLanguage())) {
ruleSet.apply(acuList, ctx);
// This is the finer RuleSet specific check
if (ruleSet.applies(ctx.getSourceCodeFile())) {
ruleSet.apply(acuList, ctx);
}
}
}
}