lkdjiin / coco

Code coverage for ruby 2.x
http://lkdjiin.github.com/coco/
MIT License
70 stars 12 forks source link

Latest coco with latest Rake results in warnings when running specs. #52

Closed grempe closed 8 years ago

grempe commented 8 years ago

Running my minitest suite with coco installed and the newly release version Rake 11.1.2 results in a warning being thrown about coco. It seems to be calling out the definition of an attr_reader under the private section of the class.

$ bundle exec rake
/usr/local/var/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/coco-0.14.0/lib/coco/cover/summary.rb:36: warning: private attribute?
...

See : https://github.com/lkdjiin/coco/blob/master/lib/coco/cover/summary.rb#L36

lkdjiin commented 8 years ago

Hi, what about running the tests directly? Is this warning emited by rake?

I don't find any reasons to warn about private attributes

grempe commented 8 years ago

I think this is not a Rake issue on further investigation. I still see the warning if I run the test directly, bypassing Rake, and Ruby warnings are turned on (-w).

Looks like this was reported but only fixed in later Rubies. I was thrown off since I upgraded Rake today and assumed it was the result of that. I now think that instead it is a result of my recent switch from Ruby 2.3.x to 2.2.4 locally (w. rbenv).

Here is a Ruby bug discussion on this issue.

https://bugs.ruby-lang.org/issues/10967

Here is a complete run, you can see that another gem is also throwing warnings.

$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]

$ bundle exec ruby -w -Itest test/session_keys_test.rb
/usr/local/var/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/coco-0.14.0/lib/coco/cover/summary.rb:36: warning: private attribute?
/usr/local/var/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/zxcvbn-ruby-0.1.1/lib/zxcvbn/matchers/l33t.rb:34: warning: shadowing outer local variable - substitution
/usr/local/var/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/zxcvbn-ruby-0.1.1/lib/zxcvbn/entropy.rb:132: warning: `-' after local variable or literal is interpreted as binary operator
/usr/local/var/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/zxcvbn-ruby-0.1.1/lib/zxcvbn/entropy.rb:132: warning: even though it seems like unary operator
Run options: --seed 327

# Running:

.......................

Fabulous run in 2.942033s, 7.8177 runs/s, 27.8719 assertions/s.

23 runs, 82 assertions, 0 failures, 0 errors, 0 skips
Cover 100% | 0 uncovered | 1 files

They do offer a way to turn it off in the discussion. Not sure if its worth it though. Feel free to close this since it is a Ruby issue (which is a bit controversial).

lkdjiin commented 8 years ago

Thanks for the reference ;)