每天结束时,我在RoR环境中运行metric_fu来衡量代码质量。一切都很好,直到今天......
当我尝试运行metric_fu时,这是我今天以来的结果。
$ bundle exec metric_fu -r
F, [2013-05-10T17:11:45.980014 #26798] FATAL -- : invalid byte sequence in UTF-8 (ArgumentError)
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/git_analyzer.rb:16:in `split'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/git_analyzer.rb:16:in `get_diff'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/source_control.rb:37:in `get_updated_files_from_log'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/source_control.rb:11:in `get_updated_files_change_info'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/churn_calculator.rb:250:in `parse_logs_for_updated_files'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/churn_calculator.rb:177:in `calculate_revision_data'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/churn_calculator.rb:165:in `block in calculate_revision_changes'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/churn_calculator.rb:160:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/churn_calculator.rb:160:in `calculate_revision_changes'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/churn_calculator.rb:59:in `analyze'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/lib/churn/churn_calculator.rb:44:in `report'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/bin/churn:32:in `report_churn'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/bin/churn:40:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/main-5.2.0/lib/main/program/class_methods.rb:155:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/main-5.2.0/lib/main/program/class_methods.rb:144:in `catch'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/main-5.2.0/lib/main/program/class_methods.rb:144:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/main-5.2.0/lib/main/factories.rb:18:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/main-5.2.0/lib/main/factories.rb:25:in `Main'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/churn-0.0.28/bin/churn:6:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/bin/mf-churn:11:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/bin/mf-churn:11:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/mf-churn:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/mf-churn:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/metrics/churn/churn.rb:10:in `analyze': undefined method `match' for nil:NilClass (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/metrics/generator.rb:129:in `block in generate_report'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/metrics/generator.rb:127:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/metrics/generator.rb:127:in `generate_report'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/reporting/report.rb:63:in `add'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/run.rb:25:in `block in run_reports'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/run.rb:23:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/run.rb:23:in `run_reports'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/run.rb:10:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/cli/helper.rb:11:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/lib/metric_fu/cli/client.rb:18:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/metric_fu-4.1.2/bin/metric_fu:9:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/metric_fu:19:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/metric_fu:19:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
我在这里找到了一个类似的问题:https://github.com/jscruggs/metric_fu/issues/61。作为GitHub上的问题的结果,我在项目的根目录中创建了一个名为“.metrics”的文件,其中包含以下内容:
MetricFu::Configuration.run do |config|
config.syntax_highlighting = false
end
不幸的是,这不起作用。
除了代码之外,最近几天都没有更新任何内容,这就是为什么这个错误突然发生的原因很奇怪。
这是我的Ruby版本:
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
提前致谢!
修改
可以通过禁用流失来绕过此问题。您可以通过添加--no-churn
来禁用流失,如下所示:
$ metric_fu -r --no-churn
修改2
由于我添加了--no-churn
一次,Metric_fu再次完全正常运行。即使在下一次报告中激活了Churn,同时分析了相同的代码。
已创建Github上的问题:https://github.com/metricfu/metric_fu/issues/70
答案 0 :(得分:1)
请输入问题on the metric_fu issues page(您有那里的旧回购链接)。基于堆栈跟踪,这实际上可能是Churn中的问题(metric_fu未处理)。另请查看我的how to write a bug report page我将就此处的错误与您合作。
答案 1 :(得分:0)
有趣的是我没有遇到关于项目或文件崩溃的任何其他细节?我可以尝试在流失中调试这个,但没有太多可以去做。您可以直接提交metric_fu问题或流失问题。我遵循这两个项目,因此无论如何我都会尝试跟进。