This project is archived and is in readonly mode.
rake stats bad method count
-
daeltar
Easy solution seems to be adding
stats["methods"] += 1 if line =~ /test \"[a-z]/to railties/lib/code_statistics.rb
-
Malte
- Tag changed from rake to 2.3.2, rake, stats
Hi, this issue persists in in 2.3.2 (of course). Daeltar, your patch looks ok, but it doesn't work for me- patched
/usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/code_statistics.rb
but still no test-stats. Maybe rake is not using this gem-directory? (I have some older versions installed, too but 2.3.2 is configured in environment.rb and app uses it with script/console etc.) Any ideas? Sorry if this is not the right place to discuss this...
-
James
You might want to try a slightly more stringent regex, something like...
stats["methods"] += 1 if line =~ /test ("(\\.|[^"\\])*"|'(\\.|[^'\\])*') do /Related: I've submitted a patch to improve class counts so that classes that are opened in several files aren't counted more than once -- see #2299 Improve class counts for 'rake stats'.
-
Matt Jones
I noticed this as well a while back, but I'm not sure what the utility of making changes to the task is - at best, it's a very rough count.
Catching 'test "blah"' lines is a good start, but what about Shoulda tests? Rspec? (and others...) Nevermind issues with code that dynamically defines methods and so forth.
-
Ryan Bigg
- State changed from new to duplicate
I agree with Matt Jones, it's a rough count and something that won't be fixed.
