5402 Commits

Author SHA1 Message Date
Xavier Le Vourch
60b76a7f10 spelling
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5763 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-12 18:44:33 +00:00
Romain Pelisse
0a99ac7e21 Small upgrade to the designer : I moved SymbolTableResultPanel below the ASTPanel. I really suck with Swing so I wasn't able to give it the proper ratio ( 7/10 of the panel for ASTPanel, 3/10 seems pretty fine with me).
I also did some code cleaning.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5762 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-12 18:40:39 +00:00
Xavier Le Vourch
54c3441c29 code cleanup: pmdOnPmd warnings
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5761 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-12 18:27:55 +00:00
Romain Pelisse
15ff2356bd Adding a "help to newbie" feature for the designer. I enhanced tooltip to provide access data (such as Abstract, Native...). The idea is that when i start designing pmd rules with the designer it was not always clear (for me) on which kind of node i'll be able to find such a data. So now, any special keyword on a AccessNode will appear in the tooltip.
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
2008-02-12 15:50:22 +00:00
Romain Pelisse
b1fa90e85c Removing HttpFilterCounterRule still not ready ...
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5759 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-12 09:06:55 +00:00
Xavier Le Vourch
a324c170c1 PMD Rule Designer shows position info in tooltip for AST nodes and highlights matching code for selected AST node in code window.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5758 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-12 02:30:15 +00:00
Romain Pelisse
e18e69e122 Bug fix : [ 1888967 ] False +: EmptyMethodInAbstractClassShouldBeAbstract
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5757 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 17:50:35 +00:00
Romain Pelisse
d143732355 Fixing out of dated XPath Query, bug [1874313] Documentation bugs. Thanks to Dave Cronin for the report!
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5756 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 16:44:11 +00:00
Ryan Gustafson
4bb7d51339 Standardize usage of FilenameFilter to use Filter APIs. Add File extension and Directory searching to Filter APIs.
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
2008-02-11 12:07:25 +00:00
Ryan Gustafson
caae2e154e Improvements to the Filter infrastructure.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5754 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 11:05:54 +00:00
Ryan Gustafson
402645df5b Refactor cpd.FileFinder to pmd.util.FileFinder. Old class is now @deprecated (and unused within PMD itself).
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5753 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 09:05:02 +00:00
Ryan Gustafson
f923ddd04a CPD Ant task will report to System.out when 'outputFile' not given.
Added 'cpdOnPmd' target to PMD build.xml.  Yeah! More dogfood!

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5752 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 08:59:04 +00:00
Ryan Gustafson
ec6f6b0e91 CPD Ant task will report to System.out when 'outputFile' not given.
Added 'cpdOnPmd' target to PMD build.xml.  Yeah! More dogfood!

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5751 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 08:41:09 +00:00
Ryan Gustafson
00bb128289 Oops, accidentally removed a JScrollPane for the Source Code window.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5750 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 08:06:37 +00:00
Ryan Gustafson
7b5afa03ac PMD Rule Designer can now shows Symbol Table contents for the selected AST node.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5749 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 07:49:27 +00:00
Ryan Gustafson
b31f691012 Rules can now be written which produce violations based upon aggregate file processing (i.e. cross/multiple file violations).
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5748 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-11 01:24:10 +00:00
Romain Pelisse
7f9f3f5c9d Addind two new rules (again out of the Lint4J rules), with proper unit testing (and both 42.xml and etc/changelog updated).
- 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
2008-02-09 22:42:07 +00:00
Romain Pelisse
63e05cdcf3 As usual, i forgot this one when i commited the new rule AvoidStringBuffer as field...
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5746 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-09 21:13:27 +00:00
Romain Pelisse
9cd5044506 Refactoring to match rule naming rather than implementing class, which is Generic.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5745 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-09 17:14:18 +00:00
Romain Pelisse
4927110084 Externalising generic methods, about regex, i wrote and used for both GenericClassCounter and GenericLiteralChecker. I create a package just for it, maybe it's overkill, maybe we should rename it helper ? I don't know really know, so fell free to refactor this if you don't feel this deserves a package.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5744 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-09 17:12:02 +00:00
Romain Pelisse
b77668fa16 Swith inheritance to AbstractJavaRule, as AbstractRule is deprecated.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5743 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-09 16:43:13 +00:00
Romain Pelisse
f9de48c1ce Adding a new rule AvoidStringBufferField.xml inspired by Lint4J one (http://www.jutils.com/checks/performance.html), with appropriate test case, and entry in changelog.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5742 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-09 16:37:40 +00:00
Romain Pelisse
59a0af1b9f Small upgrade on the documentation...
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5741 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-09 11:52:48 +00:00
Romain Pelisse
538769360f Adding documentation for Ryan's new feature (not DCD, the "violations based upon aggregate file processing (i.e. cross/multiple file violations).").
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
2008-02-09 11:45:18 +00:00
Ryan Gustafson
b3d34c346c Rules can now be written which produce violations based upon aggregate file processing (i.e. cross/multiple file violations).
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
2008-02-09 05:39:27 +00:00
Ryan Gustafson
2294864833 Initial version of Dead Code Detector. Provides a foundation data structures for the problem. Boatload of work yet to be done. See JavaDoc on DCD.java and UsageGraph.java for details. See TODOs in DCD.java for ideas of what needs to be done yet.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5738 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-07 10:01:31 +00:00
Ryan Gustafson
b178c29a24 Minor tweak to reduce attempts to resolve types for non-existent classes. Minor code reformat.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5737 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-05 22:38:42 +00:00
Ryan Gustafson
ed4ce5b28f Add utility Filter API for filtering arbitrary objects. Support for AND/OR/NOT logical operations, as well as basic String regex matching. FilterBuilder contains convenience methods for building a Filter.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5736 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-05 21:16:24 +00:00
Ryan Gustafson
cb4ac74e59 JavaDoc fix.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5735 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-05 21:12:14 +00:00
Ryan Gustafson
9f86c8b174 Refactored Rule base classes around Rule interface instead of around AST Visitor interfaces.
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
2008-02-05 05:11:17 +00:00
Ryan Gustafson
a6ac5b1002 PMD on PMD
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5733 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-05 04:34:35 +00:00
Ryan Gustafson
588117d0bd Reorder methods for clarity. Add JavaDoc. Add // FUTURE comments. Deprecated include()/setInclude(boolean).
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5732 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-05 00:21:28 +00:00
Ryan Gustafson
a06e24ce14 New elements under <ruleset>: <exclude-pattern> to match files exclude from processing, with <include-pattern> to override.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5731 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-04 11:23:07 +00:00
Romain Pelisse
1857abbcab Bug fix for [1843273] False - on SimplifyBooleanReturns
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5730 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-04 09:09:35 +00:00
Romain Pelisse
df84a10760 Adding test case for bug [ 1843273 ] False - on SimplifyBooleanReturns
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5729 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-01 16:19:23 +00:00
Romain Pelisse
ede7411582 Removing erronous commit.
Sorry.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5728 51baf565-9d33-0410-a72c-fc3788e3496d
2008-01-26 12:12:54 +00:00
Romain Pelisse
d1ef222824 Import initiale.
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
2008-01-26 11:17:01 +00:00
Xavier Le Vourch
2f12f0b01f maven depencencies for asm and retroweaver updated
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5726 51baf565-9d33-0410-a72c-fc3788e3496d
2008-01-26 02:00:32 +00:00
Xavier Le Vourch
4f570dc704 1.7 added as a valid option for targetjdk
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5725 51baf565-9d33-0410-a72c-fc3788e3496d
2008-01-08 00:18:29 +00:00
Romain Pelisse
89d7e75a8e Adding a small script to ease a little bit the release process.
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
2008-01-02 02:14:13 +00:00
Romain Pelisse
5d203e6002 adding a new rule from the lint4j catalog 'DoNotThrowExceptionInFinally', with proper unit testing, addition to the changelog and the releases/42.xml ( this is time i hope i didn't forgot anything).
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5723 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-31 16:22:13 +00:00
Xavier Le Vourch
7e4d7f9b56 typo and grammar fixes
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5722 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-29 21:25:15 +00:00
Xavier Le Vourch
a1a2747615 typo fixed
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5721 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-29 20:55:21 +00:00
Xavier Le Vourch
a7b3080563 new ruleset for 4.2 release
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5720 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-29 20:54:55 +00:00
Xavier Le Vourch
fc3e9da3c3 dtd problems with new rules fixed
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5719 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-29 20:52:16 +00:00
Romain Pelisse
eef30af6c6 (As usual, i forgot to update the changelog)
Adding 3 new rules ( plus appropriate unit testing files):

* DoNotCallGarbageCollectionExplicitly
* ReturnEmptyArrayRatherThanNull
* TooManyMethods

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5718 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-29 16:52:20 +00:00
Romain Pelisse
07fd6b6440 Adding 3 new rules ( plus appropriate unit testing files):
* DoNotCallGarbageCollectionExplicitly
* ReturnEmptyArrayRatherThanNull
* TooManyMethods 

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5717 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-29 16:49:15 +00:00
Xavier Le Vourch
00caedd647 Fixed bug 1855409 - False + in EmptyMethodInAbstractClassShouldBeAbstract
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
2007-12-21 01:25:39 +00:00
Torsten Kleiber
d528747d25 Release 4.1.3.0.0
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5704 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-18 14:20:11 +00:00
Torsten Kleiber
7a08c0d3ac Release 4.1.2.0.0
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5703 51baf565-9d33-0410-a72c-fc3788e3496d
2007-12-18 14:15:29 +00:00