I already implemented this 6 month ago but i didn't have the commit it. Since the designer class has been revised,my modifications, still on the patch tracker, became obsolete.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5760 51baf565-9d33-0410-a72c-fc3788e3496d
This is an incremental cleanup. The real cleanup is the unify all these Language specific concepts across the entire PMD code base. Specifically, the CPD Language stuff, SourceType, SourceTypeHandler, TargetJDK, Parsers, AST nodes, and anything else I missed. That change will wait until we're ready to do a major PMD internal refactoring.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5755 51baf565-9d33-0410-a72c-fc3788e3496d
- AbstractClassWithoutAnyMethod
- TooFewBranchesForASwitchStatement
Also, i disabled rule and test about the HttpFilterCounter rule, that is still buggy...
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5747 51baf565-9d33-0410-a72c-fc3788e3496d
I've begin to implements such a rule (well, more of a generic rule). I'll try to finish tonight. I also added a test case.
Thanks Ryan for this, somehow small, but quite usefull upgrade ;) !
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5740 51baf565-9d33-0410-a72c-fc3788e3496d
Added Rule.start() and Rule.end() for pre/post processing hooks. Added shared attributes to RuleContext for storage of shared state across all Rule.apply() invocations. Essentially a rule could on (1) Rule.start() does any necessary setup on RuleContext attributes, (2) Rule.apply() accumulates results in RuleContext attributes (must be thread-safe!), (3) Rule.end() gets/removes RuleContext attributes to produce any necessary violations.
Inane example:
package net.sourceforge.pmd.rules;
import java.util.concurrent.atomic.AtomicLong;
import net.sourceforge.pmd.AbstractJavaRule;
import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.ast.ASTExpression;
public class CountRule extends AbstractJavaRule {
private static final String COUNT = "count";
@Override
public void start(RuleContext ctx) {
ctx.setAttribute(COUNT, new AtomicLong());
super.start(ctx);
}
@Override
public Object visit(ASTExpression node, Object data) {
// How many Expression nodes are there in all files parsed! I must know!
RuleContext ctx = (RuleContext)data;
AtomicLong total = (AtomicLong)ctx.getAttribute(COUNT);
total.incrementAndGet();
return super.visit(node, data);
}
@Override
public void end(RuleContext ctx) {
AtomicLong total = (AtomicLong)ctx.getAttribute(COUNT);
addViolation(ctx, null, new Object[] { total });
ctx.removeAttribute(COUNT);
super.start(ctx);
}
}
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5739 51baf565-9d33-0410-a72c-fc3788e3496d
Long term goal is to support additional languages beyond Java. Organized like so:
pmd.AbstractRule // Core Rule implementation
pmd.XPathRule // Core XPath Rule implementation
pmd.java.AbstractJavaRule // Java specific Rule implementation
pmd.jsp.AbstractJspRule // JSP specific Rule implementation
pmd.xxx.AbstractXxxRule // Language XXX specific Rule implementation
...
This is a start, there's a much larger reorganizing effort to get things in sync. Additional work is needed on generalizing XPathRule.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5734 51baf565-9d33-0410-a72c-fc3788e3496d
Support, sujet d'un TD dédié aux outils du génie logiciel (ici spécifiquement Ant et CVS). Le TD a eu lieu en sept 2007.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5727 51baf565-9d33-0410-a72c-fc3788e3496d
This script takes care of this:
update rulesets/rulesets.properties - add any new ruleset file names
By the way, thanks to Alan for his response about this, and Happy New Year to everyone !
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5724 51baf565-9d33-0410-a72c-fc3788e3496d
Fixed other false positives in EmptyMethodInAbstractClassShouldBeAbstract
rule should now detect only empty methods and methods only returning null
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5716 51baf565-9d33-0410-a72c-fc3788e3496d