質問

私は私が働いているレールのプロジェクトで実行されているメトリック-FUを取得しようとしています。たびに、それは私が手メトリクスのrcov部分を実行します:

** Invoke metrics:all (first_time)
** Execute metrics:all

No file to analyze was found. All the files loaded by rcov matched one of the
following expressions, and were thus ignored:
[/\A\/System\/Library\/Frameworks\/Ruby\.framework\/Versions\/1\.8\/usr\/lib/,
 /\btc_[^.]*.rb/,
 /_test\.rb\z/,
 /\btest\//,
 /\bvendor\//,
 /\A\/Library\/Ruby\/Gems\/1\.8\/gems\/rcov\-0\.9\.7\.1\/lib\/rcov\/formatters\/base_formatter\.rb\z/,
 /\bvendor\//,
 /\bconfig\//,
 /\benvironment\//,
 /\/gems\//,
 /\/Library\//,
 /spec/]

You can solve this by doing one or more of the following:
* rename the files not to be ignored so they don't match the above regexps
* use --include-file to give a list of patterns for files not to be ignored
* use --exclude-only to give the new list of regexps to match against
* structure your code as follows:
      test/test_*.rb  for the test cases
      lib/**/*.rb     for the target source code whose coverage you want
  making sure that the test/test_*.rb files are loading from lib/, e.g. by 
  using the -Ilib command-line argument, adding  
    $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
  to test/test_*.rb, or running rcov via a Rakefile (read the RDoc
  documentation or README.rake in the source distribution).
rake aborted!
NaN
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/core_ext/float/rounding.rb:19:in `round_without_precision'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/core_ext/float/rounding.rb:19:in `round'
/Library/Ruby/Gems/1.8/gems/metric_fu-1.2.0/lib/base/generator.rb:135:in `round_to_tenths'
/Library/Ruby/Gems/1.8/gems/metric_fu-1.2.0/lib/generators/rcov.rb:84:in `to_h'
/Library/Ruby/Gems/1.8/gems/metric_fu-1.2.0/lib/base/generator.rb:131:in `generate_report'
/Library/Ruby/Gems/1.8/gems/metric_fu-1.2.0/lib/base/generator.rb:53:in `generate_report'
/Library/Ruby/Gems/1.8/gems/metric_fu-1.2.0/lib/base/report.rb:54:in `add'
/Library/Ruby/Gems/1.8/gems/metric_fu-1.2.0/lib/../tasks/metric_fu.rake:6
/Library/Ruby/Gems/1.8/gems/metric_fu-1.2.0/lib/../tasks/metric_fu.rake:6:in `each'
/Library/Ruby/Gems/1.8/gems/metric_fu-1.2.0/lib/../tasks/metric_fu.rake:6
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

それ自体でrcovを実行すると、同じ問題を思い付きます。私はそれが助け場合TestUnit RSpecのを使用していないよ。

役に立ちましたか?

解決

あなたはこのスニペットでパスをrcovする任意のディレクトリを追加することができますmetric_fu起動するようにレーキを使用している場合:

begin  
  require 'metric_fu'
  MetricFu::Configuration.run do |config|  
     config.rcov[:rcov_opts] << "-Ispec"  
  end 
rescue LoadError  
end

これは、順番にrcovのパスに「スペック」ディレクトリを追加するオプションを、rcovするための -Ispec のフラグを追加します。

他のヒント

私は「テスト」ディレクトリを削除し、Rcov構成ハッシュに「--includeスペック/ spec_helper.rb」を追加しました。私はそれは、特にそれ以外の場合はtestunitとRSpecのない上rcov実行しようとスペックヘルパーを指摘し、テストディレクトリを削除する必要があることが必要だと思います。

これは他の人に役に立てば幸い!

だから、rcovは、それが表示されるこの事ありません「分析するファイルが見つからなかったの。」問題は、実際にメッセージ以下のスタックトレースであるメッセージ。あなたは(どのバージョンあなたがオンになっている?)rcovのバージョンをアップグレードしようとすることができます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top