Open webervin opened 7 years ago
Could you include metric_fu --debug-info
as requested in https://github.com/metricfu/metric_fu/blob/master/CONTRIBUTING.md#bug-reports--issues and how you've installed metric_fu and how you're running it? It looks like it's in your bundle, so I'm guessing it's in your gemfile.
Oooh... I bet OP is scanning a directory that ends in ".rake"
https://github.com/metricfu/metric_fu/blob/master/lib/metric_fu/metrics/flog/generator.rb#L60
kdi882 % cd /tmp
884 % mkdir -p x/y/z.rb/q
885 % touch x/y/z.rb/q/blah.rb
888 % cd x
889 % ruby -e 'p Dir["**/*.{rb,rake}"]'
["y/z.rb", "y/z.rb/q/blah.rb"]
I don't think path_expander handles that properly either... Nope.
I get a similar error when running it on my Rails project. I installed it with gem install metric_fu --user-install
.
Here's the Flog part of the output when I run metric_fu
in the root of my project (no .metrics file):
******* STARTING METRIC flog
/home/adrien/.gem/ruby/2.3.0/gems/flog-4.4.0/lib/flog.rb:175:in `binread': Is a directory @ io_fread - app (Errno::EISDIR)
from /home/adrien/.gem/ruby/2.3.0/gems/flog-4.4.0/lib/flog.rb:175:in `block in flog'
from /home/adrien/.gem/ruby/2.3.0/gems/flog-4.4.0/lib/flog.rb:172:in `each'
from /home/adrien/.gem/ruby/2.3.0/gems/flog-4.4.0/lib/flog.rb:172:in `flog'
from /home/adrien/.gem/ruby/2.3.0/gems/flog-4.4.0/lib/flog_cli.rb:163:in `flog'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/metrics/flog/generator.rb:16:in `emit'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/generator.rb:104:in `generate_result'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/reporting/result.rb:48:in `add'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/run.rb:21:in `block in measure'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/run.rb:19:in `each'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/run.rb:19:in `measure'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/run.rb:9:in `run'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/cli/helper.rb:19:in `run'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/lib/metric_fu/cli/client.rb:19:in `run'
from /home/adrien/.gem/ruby/2.3.0/gems/metric_fu-4.12.0/bin/metric_fu:9:in `<top (required)>'
from /home/adrien/.gem/ruby/2.3.0/bin/metric_fu:22:in `load'
from /home/adrien/.gem/ruby/2.3.0/bin/metric_fu:22:in `<main>'
And the metric_fu --debug-output
output:
{"Ruby"=>
{"Engine"=>"ruby",
"Version"=>"2.3.1",
"Patchlevel"=>112,
"Ripper Support"=>true,
"Rubygems Version"=>"2.6.8",
"Long Description"=>"ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]"},
"Environment"=>
{"VERBOSE"=>"false",
"External Encoding"=>"UTF-8",
"Internal Encoding"=>"",
"Host Architecture"=>"x86_64-pc-linux-gnu",
"Ruby Prefix"=>"/usr",
"Ruby Options"=>""},
"MetricFu"=>
{"Version"=>"4.12.0",
"Verbose Mode"=>false,
"Enabled Metrics"=>
[:stats,
:churn,
:rails_best_practices,
:flay,
:roodi,
:flog,
:saikuro,
:reek,
:cane,
:hotspots],
"Dependencies"=>
[{"name"=>"flay", "version"=>"2.8.1"},
{"name"=>"churn", "version"=>"0.0.35"},
{"name"=>"flog", "version"=>"4.4.0"},
{"name"=>"reek", "version"=>"2.2.1"},
{"name"=>"cane", "version"=>"2.6.2"},
{"name"=>"rails_best_practices", "version"=>"1.17.0"},
{"name"=>"saikuro", "version"=>[">= 1.1.3", "~> 1.1"]},
{"name"=>"roodi", "version"=>"3.3.1"},
{"name"=>"code_metrics", "version"=>"0.1.3"},
{"name"=>"redcard", "version"=>"1.1.0"},
{"name"=>"coderay", "version"=>"1.1.1"},
{"name"=>"multi_json", "version"=>"1.12.1"},
{"name"=>"launchy", "version"=>"2.4.3"},
{"name"=>"rcov", "version"=>["~> 0.8"]}]}}
@ChallahuAkbar can you manually patch /home/adrien/.gem/ruby/2.3.0/gems/flog-4.4.0/lib/flog.rb:175
and print out the path before the binread?
@zenspider Done, it prints app
as that's the first dir in the project folder and then the rest of the output is the same as before.
Wait a minute, I just remembered—my project directory has a -
in its name! I have to go for the moment, but I'll test it again with the folder renamed when I get back
Nope, still the same output.
Well, then my guess is wrong... no clue.
metric_fu 4.12.0 does not contain #273 - did we not release this fix?
@bergholdt I don't believe a new version has been released in a while, which is probably why your fix isn't in there. Speaking of which, we should do this asap.
@webervinj I actually use this gem by using the latest from master. Can you try doing the same? At least for now until we can get a new version published with these fixes.
If this is for a Rails project, you can add it to your Gemfile like so:
group :test do
gem 'metric_fu', git: 'https://github.com/metricfu/metric_fu.git'
end
I can help release if someone checks the changelog and what the version should be
B mobile phone
On Jan 9, 2017, at 12:26 PM, Jonathan Keam notifications@github.com wrote:
@bergholdt I don't believe a new version has been released in a while, which is probably why your fix isn't in there. Speaking of which, we should do this asap.
@webervinj I actually use this gem by using the latest from master. Can you try doing the same? At least for now until we can get a new version published with these fixes.
If this is for a Rails project, you can add it to your Gemfile like so:
group :test do gem 'metric_fu', git: 'https://github.com/metricfu/metric_fu.git' end — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
What's the status of this?
D'oh, it looks like #294 is the issue that will release the new version and get all these fixes in, but unfortunately we got some broken tests that need to be looked at and fixed up. Not entirely sure what's going on, but I can take a look a bit later and try and diagnose/fix it. Unless of course someone else beats me to it and opens a PR for it :)
@jkeam Did a rebuild of #294 and all are green now.
Everything looks good 👍
... status update?
@bf4 I think we are all good for a release :)
There should definitely be a new release. I'm using Ruby 2.3 and the latest released version simply does not work with a lot of the metrics. If I get the latest from GitHub though, more things work. New release please :)
Two things that are still not working for me... Reek and Roodi. Which is a shame, because I really want the stats from them.
STDERR from roodi:
C:/Ruby23/lib/ruby/gems/2.3.0/gems/roodi-5.0.0/lib/roodi/core/runner.rb:52:in `output_result': Found
423 errors. (RuntimeError)
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/roodi-5.0.0/lib/roodi/core/runner.rb:41:in `start'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/roodi-5.0.0/bin/roodi:26:in `<top (required)>'
from c:/Ruby23/bin/roodi:22:in `load'
from c:/Ruby23/bin/roodi:22:in `<main>'
******* ENDING METRIC roodi
******* STARTING METRIC reek
C:/Ruby23/lib/ruby/gems/2.3.0/gems/reek-2.2.1/lib/reek/source/source_code.rb:21:in `initialize':
uninitialized constant Parser::Ruby21 (NameError)
Did you mean? Parser::Ruby23
Ruby21Parser
Ruby23Parser
Ruby22Parser
Ruby24Parser
Ruby20Parser
Ruby19Parser
Ruby18Parser
RubyVM
churn is also not working for me because my SVN is TFS.
Agreed! I'm actually pulling from master myself for my project. @bf4 can you perform a release?
Hm..didn't notice the reek and roodi errors.
I'm happy to help release a new version. I feel really badly about the current state of things
@dbwest @bf4 @jkeam FWIW, here is a PR to fix the issues with reek
-> https://github.com/metricfu/metric_fu/pull/306
I had to upgrade the dependency and update the usage code to use their newer API.
bundle update did not help, discussion @flog repo