Removed redundant calls to PMD.setExcludeMarker() from the Ant task.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@3625 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2005-06-27 22:09:47 +00:00
parent f386bf58bd
commit 611c696ef1
3 changed files with 8 additions and 8 deletions

View File

@ -71,7 +71,7 @@
<target name="pmd" description="Runs PMD">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
<pmd rulesetfiles="unusedcode" shortFilenames="true">
<pmd excludemarker="MYNOPMD" rulesetfiles="unusedcode" shortFilenames="true">
<formatter type="html" toFile="rpt.html" linkPrefix="http://pmd.sf.net/xref/"/>
<fileset dir="/home/tom/pmd/pmd/src/">
<include name="**/renderers/*.java"/>

View File

@ -5,7 +5,8 @@ Fixed bug 1227001 - AvoidCallingFinalize no longer flags calls to finalize() wit
Fixed a bug in RuleSetFactory that missed some override cases; thx to Wouter Zelle for the report and a fix.
Improved UseCorrectExceptionLogging; thx to Wouter Zelle for the new XPath.
The Ant task now accepts the short names of rulesets (e.g., unusedcode for rulesets/unusedcode.xml).
Removed unnecessary '.html' suffix to HTML renderer when the linkPrefix attribute is used.
Removed redundant calls to PMD.setExcludeMarker() from the Ant task.
Removed unnecessary '.html' suffix from displayed filenames when the linkPrefix attribute is used with the HTML renderer.
Moved AvoidCallingFinalize from the design ruleset to the finalize ruleset.
Deleted redundant ExplicitCallToFinalize rule.

View File

@ -119,9 +119,9 @@ public class PMDTask extends Task {
public void execute() throws BuildException {
validate();
ruleSetFiles = new SimpleRuleSetNameMapper(ruleSetFiles).getRuleSets();
RuleSet rules;
try {
RuleSetFactory ruleSetFactory = new RuleSetFactory();
if (classpath == null) {
@ -134,7 +134,6 @@ public class PMDTask extends Task {
} catch (RuleSetNotFoundException e) {
throw new BuildException(e.getMessage());
}
logRulesUsed(rules);
PMD pmd;
@ -145,6 +144,10 @@ public class PMDTask extends Task {
} else {
pmd = new PMD();
}
if (excludeMarker != null) {
log("Setting exclude marker to be " + excludeMarker, Project.MSG_VERBOSE);
pmd.setExcludeMarker(excludeMarker);
}
RuleContext ctx = new RuleContext();
ctx.setReport(new Report());
@ -156,10 +159,6 @@ public class PMDTask extends Task {
File file = new File(ds.getBasedir() + System.getProperty("file.separator") + srcFiles[j]);
log("Processing file " + file.getAbsoluteFile().toString(), Project.MSG_VERBOSE);
ctx.setSourceCodeFilename(shortFilenames ? srcFiles[j] : file.getAbsolutePath());
if (excludeMarker != null) {
log("Setting exclude marker to be " + excludeMarker, Project.MSG_VERBOSE);
pmd.setExcludeMarker(excludeMarker);
}
try {
pmd.processFile(new BufferedInputStream(new FileInputStream(file)), encoding, rules, ctx);
} catch (FileNotFoundException fnfe) {