Metrical metric_fu ruby​​1.9.2 Rails3.0 undefined方法`length'代表nil:NilClass

时间:2011-10-31 11:37:26

标签: ruby ruby-on-rails-3 metric-fu metrical

我正在尝试使用我的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报告,但有两个问题:

  1. 重要的任务没有完成它的工作。它似乎陷入无限循环。
  2. 像reek,roodi和rails最佳实践的一些报告可以成功显示结果,但不显示图表;他们显示“无数据”代替图表
  3. 我不确定我的ruby代码更新是否会损害它或其他什么?

0 个答案:

没有答案