0

我正在使用 metric_fu 4.4.1

我的 .metrics 文件说:

MetricFu::Configuration.run do |config|  
 config.metrics -= [:reek]  
 config.metrics -= [:flay]  
 config.metrics -= [:flog]
end

我的 metric_fu.rake 说:

begin
  require 'metric_fu'
rescue LoadError
  puts 'Could not load metric_fu'
end 

当我运行时:bundle exec rake metrics:all get the falling error

rake aborted!
undefined method `metrics' for #<MetricFu::Configuration:0xa3d4f14>
/home/montells/Projects/beesor/.metrics:2:in `block in <top (required)>'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/metric_fu-4.4.1/lib/metric_fu/configuration.rb:102:in `run'
/home/montells/Projects/beesor/.metrics:1:in `<top (required)>'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/metric_fu-4.4.1/lib/metric_fu/run.rb:32:in `load_user_configuration'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/metric_fu-4.4.1/lib/metric_fu/run.rb:6:in `initialize'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/metric_fu-4.4.1/lib/metric_fu/tasks/metric_fu.rake:5:in `new'
/home/montells/.rvm/gems/ruby-1.9.3-p392/gems/metric_fu-4.4.1/lib/metric_fu/tasks/metric_fu.rake:5:in `block (2 levels) in <top (required)>'
Tasks: TOP => metrics:all
(See full trace by running task with --trace)
4

1 回答 1

2

我通过谷歌群组收到了这个问题的答案。 点击这里

MetricFu::Configuration.run do |config|
  config.configure_metrics.each do |metric|
    if [:reek, :flay, :flog].include?(metric.name)
      metric.enabled = false
    else
      metric.enabled = true
    end
  end
end

并向本杰明·弗莱舍定价

于 2013-09-26T15:40:43.823 回答