From: Ryan Davis Date: 2011-05-24T07:10:21+09:00 Subject: Re: Tools for Ruby code analysis On May 23, 2011, at 06:32 , Alex V. wrote: > Hello everyone, > > I'm new in Ruby and I'm looking for analysis tools like Pylint and > Pymetrics (for Python). I have already tried those ones: > - Kwala (that looks very interresting and which is a group of other > tools), > - Saikuro, > - Metric_fu. > > But all the time, something is going wrong: > - Kwala doesn't work with Ruby 1.9.2 because of Amrita which requires > ftools; Kwala is working with Ruby 1.8 but not entirely: some features > don't work. I'm not familiar with kwala and am only just now poking at it. It looks like it has a lot of high level dependencies that might make it rough around the edges. The amrita code should be REALLY easy to patch up and get working with fileutils, but there are probably other issues in there as well. kwala says it does: • PMD's CPD for code duplication. http://pmd.sourceforge.net/ • Prefuse for require graph visualization. http://www.prefuse.org/ • Saikuro for cyclomatic complexity checks http://saikuro.rubyforge.org/ • rcov for code coverage http://eigenclass.org/hiki.rb?rcov and that makes me think it is pretty much like metric_fu. CPD you can replace with flay (but see below). Prefuse I've never heard of and will have to play with. It looks neat. Saikuro is also used in metric_fu, so that'll have the same problems. > - Saikuro works pretty well with Ruby 1.8.7 :) ... but doesn't work with > Ruby 1.9.2, anyway Saikuro makes only an complexity analysis, and not > all the features (theoretically) offered by Kwala. Unfortunately, a lot of coverage tools are going to have this problem. 1.9.x was pretty hostile to us 1.8.x tool authors. I don't know if any work is going on to try to make saikuro work using 1.9 technologies. You can however, use flog for complexity analsis (but see below). > - For Metric_fu, the installation with Rubygems simply doesn't work. Worked for me: > % gem i -i xxx metric_fu > ... > Successfully installed sexp_processor-3.0.5 > Successfully installed ruby_parser-2.0.6 > Successfully installed flay-1.4.2 > Successfully installed flog-2.5.1 > Successfully installed rcov-0.9.9 > Successfully installed ruby2ruby-1.2.5 > Successfully installed reek-1.2.8 > Successfully installed roodi-2.1.0 > Successfully installed ruby-progressbar-0.0.10 > Successfully installed colored-1.2 > Successfully installed erubis-2.7.0 > Successfully installed haml-3.1.1 > Successfully installed i18n-0.6.0 > Successfully installed activesupport-3.0.7 > Successfully installed rails_best_practices-0.9.0 > Successfully installed chronic-0.3.0 > Successfully installed fattr-2.2.0 > Successfully installed arrayfields-4.7.4 > Successfully installed main-4.4.0 > Successfully installed json_pure-1.5.1 > Successfully installed hirb-0.4.5 > Successfully installed churn-0.0.13 > Successfully installed Saikuro-1.1.0 > Successfully installed syntax-1.0.0 > Successfully installed metric_fu-2.1.1 > 25 gems installed If you still have problems, please file a bug on rubygems with the appropriate details. FLOG and FLAY: These tools work on 1.8 as well as 1.9. However, since they use ruby_parser, they currently only parse 1.8 code. If you use 1.9isms, they will throw a parse error (there are flags to continue after errors where appropriate).