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!
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?
Posted by: hgs | July 12, 2007 at 05:26 AM
hgs - Thanks for the suggestion; I tried it but no go. I modified the code to shorten the lines, though, thanks for the comment...
Posted by: Tom Copeland | July 12, 2007 at 09:51 AM