Jeremy,

> Dan, what's the Eclipse issue with ruleset? Is it a Eclipse extension
> thing or something that would impact the main build?

The eclipse PMD plugin has some strange "design flaws" (IMO) that make it 
harder to use than it really should be.   The main restriction is that there 
isn't really a way to set a "global" ruleset that can be referenced by the 
project.   For example, with the Checkstyle plugin, in our workspace we can 
create a named set of checkstyle rules called "Tuscany Checks" that points to 
the tuscany-checkstyle.xml file.   The ".checkstyle" file in each project is 
then very small, it just says "use Tuscany Checks".   That way, if the 
tuscany-checkstyle.xml changes, then all projects get the changes.

PMD, on the otherhand, cannot do that.   It only sets rules in one of two 
ways:
1) In the project, there is a ".ruleset" file that defines all the rules for 
that project.   This means the .ruleset file needs to be copied to ALL 
directories and if you want to change the PMD rules, you need to re-copy to 
all directories.  (although that does allow different directories to have 
different rules)

2) You configure a bunch of rules in the workspace, but each project then 
specifies which of those rules to use in their .pmd file.   Thus, if you want 
to add a new rule, you need to modify the .pmd file in each directory.   That 
sucks just as bad.   

The PMD maven plugin doesn't suffer the problem.   It can use a single file 
defined elsewhere (in the buildtools jar) for all the projects.   The 
workaround I mentioned was to create a "setup.eclipse" profile that unpacks 
the file from that jar and creates the .ruleset file from it.   Thus, each 
directory doesn't have the .ruleset file checked into svn.   It's created 
only if you need it for eclipse.   The cool thing is the "setup.eclipse" 
profile can also generate the .checkstyle and .pmd files at the same time so 
those don't get checked in.   (just FYI: we are NOT doing this in celtix yet.   
I just figured out how to do that workaround last week)

PMD has some other problems as well:
1) The MAVEN PMD plugin cannot check the test sources.   It can ONLY be 
configured to test src/main/java.     I've already logged a bug on that.

2) The ECLIPSE PMD plugin cannot be configured to NOT check the generated 
sources.   This is a real killer for projects that have generated artifacts.   
In general, generated artifacts rarely meet all the .pmd requirements unless 
the .pmd requirements aren't very strict.   For Celtix, we use very few PMD 
rules so the JAXB generated code passes.

3) PMD is pretty slow.   Checkstyle is about the same speed as Javac.   If you 
configure a bunch of PMD rules, it can take a LONG time.   However, because 
of (2), we don't configure many rules so it's not too bad.


Anyway, those are all PMD issues, not Checkstyle.   The checkstyle stuff works 
quite well.   You can tell Checkstyle to check only ^src/**/*.java so the 
stuff in target/generated is ignored.    You can use a "named" config file so 
each project doesn't need one.   It's also relatively quick (compared to 
PMD).


> Or a somewhat related note, does anyone have any experience with the
> Jetstyle IDEA plugin (or another way of integrating this with IDEA)?

Haven't tried it yet.   I just started trying out IDEA on Wednesday.  I'm 
investigating if it can help with some big "Celtix refactorings" that we're 
working on, but it hung when I tried to do a major refactor (change the 
package names for EVERYTHING).  (That said, eclipse didn't fare much better)


-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194   F:781-902-8001
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to