This post originated from an RSS feed registered with Agile Buzz
by Marty Andrews.
Original Post: First official release of Roodi
Feed Title: Ramblings of the Wry Tradesman
Feed URL: http://www.wrytradesman.com/blog/index.rdf
Feed Description: Marty Andrews talks about the day to day issues he faces as an agile coach on large enterprise applications in Australia.
Roodi is now a few weeks old, and ready for it's first official release. It statically parses your Ruby code and warns you about design issues that you might have. to install Roodi, run this command:
gem install roodi
You can then run the roodi command and give it a list of patterns to find files to check. For example, you could:
Check all ruby files in a rails app:
roodi "rails_app/**/*.rb"
...or check one controller and all model files in a rails app:
Here's an example of what Roodi output looks like when it is run against the Hpricot source code:
pudbookpro:Data marty$ roodi "hpricot/**/*.rb"
hpricot/extras/mingw-rbconfig.rb:155 - Block cyclomatic complexity is 5. It should be 4 or less.
hpricot/lib/hpricot/builder.rb:75 - Block cyclomatic complexity is 5. It should be 4 or less.
hpricot/lib/hpricot/parse.rb:52 - Block cyclomatic complexity is 40. It should be 4 or less.
hpricot/lib/hpricot/traverse.rb:50 - Block cyclomatic complexity is 5. It should be 4 or less.
hpricot/lib/hpricot/traverse.rb:315 - Block cyclomatic complexity is 5. It should be 4 or less.
hpricot/lib/hpricot/traverse.rb:555 - Block cyclomatic complexity is 11. It should be 4 or less.
hpricot/setup.rb:215 - Block cyclomatic complexity is 6. It should be 4 or less.
hpricot/setup.rb:578 - Block cyclomatic complexity is 5. It should be 4 or less.
hpricot/lib/hpricot/builder.rb:63 - Method name "tag!" has a cyclomatic complexity is 15. It should be 8 or less.
hpricot/lib/hpricot/traverse.rb:247 - Method name "search" has a cyclomatic complexity is 27. It should be 8 or less.
hpricot/lib/hpricot/traverse.rb:553 - Method name "each_hyperlink_attribute" has a cyclomatic complexity is 11. It should be 8 or less.
hpricot/lib/hpricot/traverse.rb:774 - Method name "author" has a cyclomatic complexity is 12. It should be 8 or less.
hpricot/setup.rb:147 - Method name "standard_entries" has a cyclomatic complexity is 13. It should be 8 or less.
hpricot/setup.rb:858 - Method name "parsearg_global" has a cyclomatic complexity is 10. It should be 8 or less.
hpricot/setup.rb:1265 - Method name "update_shebang_line" has a cyclomatic complexity is 9. It should be 8 or less.
hpricot/lib/hpricot/traverse.rb:781 - Rescue block should not be empty.
hpricot/lib/hpricot/traverse.rb:791 - Rescue block should not be empty.
hpricot/lib/hpricot/traverse.rb:800 - Rescue block should not be empty.
hpricot/lib/hpricot/traverse.rb:807 - Rescue block should not be empty.
hpricot/lib/hpricot.rb:17 - Rescue block should not be empty.
hpricot/setup.rb:592 - Rescue block should not be empty.
hpricot/setup.rb:601 - Rescue block should not be empty.
hpricot/setup.rb:613 - Rescue block should not be empty.
hpricot/lib/hpricot/builder.rb:63 - Method name "tag!" has 31 lines. It should have 20 or less.
hpricot/lib/hpricot/traverse.rb:247 - Method name "search" has 80 lines. It should have 20 or less.
hpricot/setup.rb:147 - Method name "standard_entries" has 51 lines. It should have 20 or less.
hpricot/setup.rb:948 - Method name "print_usage" has 31 lines. It should have 20 or less.
hpricot/test/test_parser.rb:69 - Method name "scan_basic" has 50 lines. It should have 20 or less.
hpricot/lib/hpricot/parse.rb:3 - Method name "Hpricot" should match pattern /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/
The default parameters for checks can be changed, and checks can be turned on and off. Lots of additional checks are planned, as is support for rake tasks and rails plugins.
Please drop me a line if you use Roodi and find it useful. I'd love to get some feedback on how people are using it. Happy checking!