我正在尝试使用我的 rails 3.0 应用程序运行 metric_fu。我已经检查了metrical gem 以避免依赖问题并使设置 metric_fu 更容易。
我可以让它工作,但只有一个例外
/home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/syntax-1.0.0/lib/syntax/lang/ruby.rb:239:in `block in scan_delimited_region': undefined method `length' for nil:NilClass (NoMethodError)
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/syntax-1.0.0/lib/syntax/lang/ruby.rb:231:in `loop'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/syntax-1.0.0/lib/syntax/lang/ruby.rb:231:in `scan_delimited_region'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/syntax-1.0.0/lib/syntax/lang/ruby.rb:143:in `step'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/syntax-1.0.0/lib/syntax/common.rb:77:in `tokenize'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/syntax-1.0.0/lib/syntax/convertors/html.rb:16:in `convert'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metric_fu-2.1.1/lib/templates/awesome/awesome_template.rb:59:in `block (2 levels) in write_file_data'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metric_fu-2.1.1/lib/templates/awesome/awesome_template.rb:46:in `each'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metric_fu-2.1.1/lib/templates/awesome/awesome_template.rb:46:in `each_with_index'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metric_fu-2.1.1/lib/templates/awesome/awesome_template.rb:46:in `block in write_file_data'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metric_fu-2.1.1/lib/templates/awesome/awesome_template.rb:40:in `each_pair'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metric_fu-2.1.1/lib/templates/awesome/awesome_template.rb:40:in `write_file_data'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metric_fu-2.1.1/lib/templates/awesome/awesome_template.rb:34:in `write'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metric_fu-2.1.1/lib/base/report.rb:48:in `save_templatized_report'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metrical-0.0.7/lib/metrical.rb:54:in `run_metric_fu'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metrical-0.0.7/lib/metrical.rb:18:in `run'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/gems/metrical-0.0.7/bin/metrical:4:in `<top (required)>'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/bin/metrical:19:in `load'
from /home/mahmoud/.rvm/gems/ruby-1.9.2-p180@metrics/bin/metrical:19:in `<main>'
我试图编辑这个文件 gems/syntax-1.0.0/lib/syntax/lang/ruby.rb line#239
start_group inner_group, text if text.length > 0
并将其编辑为
start_group inner_group, text if !text.blank?
这次它毫无例外地工作,我可以生成 metric_fu 报告,但有两个问题:
- mertrical 任务没有完成它的工作。它似乎陷入了无限循环。
- 一些报告,如 reek、roodi 和 rails best practice 可以成功显示结果,但不显示图表;他们显示“无数据”代替图表
我不确定我的 ruby 代码更新是否会损害它或其他原因?