Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endless warnings about uninitialized variable #10

Closed
mvz opened this issue Aug 12, 2011 · 5 comments
Closed

Endless warnings about uninitialized variable #10

mvz opened this issue Aug 12, 2011 · 5 comments

Comments

@mvz
Copy link

mvz commented Aug 12, 2011

Hi, I run my tests with warnings enabled, and each test outputs:

[...]/wrong-0.5.4/lib/wrong/assert.rb:23: warning: instance variable @_inside_wrong_assert not initialized

Adding the following just before the offending line solves this:

@_inside_wrong_assert ||= false
@alexch
Copy link
Collaborator

alexch commented Aug 12, 2011

Hmm. I rarely use -w because I don't agree that everything they warn about is actually a problem. In this case I'm a bit shocked, since "instance variables default to nil" is one of the features that makes Ruby such a concise language. I'm reluctant to clutter our code with a pointless initializer. OTOH, the customer is king... so I'd be happy to hear arguments on the other side.

@mvz
Copy link
Author

mvz commented Aug 14, 2011

My argument would be that if you make a gem run without warnings, it can be cleanly used by people who like using -w. That's why I'm running my tests with warnings on, since they're tests for a gem.

@alexch
Copy link
Collaborator

alexch commented Aug 17, 2011

I hate it when people come up with reasonable arguments!

OK, you're probably right. This would fall under the "it's a library, so you can't just do anything you want" category, along with monkey patching.

@alexch
Copy link
Collaborator

alexch commented Aug 24, 2011

Fixed with release 0.5.4 (and .5 and .6 ... don't ask!) -- please confirm.

@alexch alexch closed this as completed Aug 24, 2011
@mvz
Copy link
Author

mvz commented Aug 25, 2011

Yes, confirmed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants