Now in stock!

Tom Copeland's Recent Posts

RSS Feeds

« A Java to HTML converter | Main | PMD 4.0rc2 released - Java 1.5 by default »

Finding PMD rules with multiple examples

I was working on some stuff before releasing PMD 4.0rc2 tonight and was trying to find any rulesets which had rules with more than one example.  A Ruby one-liner to the rescue!

$ ruby -rrexml/document -e 
  'include REXML ; 
  Dir.glob("*.xml").each {|f| r = Document.new(File.read(f)).elements
  ["//ruleset/rule[count(example)>1]"] ; 
  puts f if r }'
j2ee.xml
basic.xml

XPath and Ruby are a pretty sweet combination!

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/512521/19979892

Listed below are links to weblogs that reference Finding PMD rules with multiple examples:

Comments

With large print, in Firefox, the lines of code get truncated but I don't get a scrollbar. I wonder if putting the pre in a div with margins: auto; would fix that?

hgs - Thanks for the suggestion; I tried it but no go. I modified the code to shorten the lines, though, thanks for the comment...

Post a comment

Comments are moderated, and will not appear on this weblog until the author has approved them.

If you have a TypeKey or TypePad account, please Sign In