njh / ruby-mqtt

Pure Ruby gem that implements the MQTT protocol, a lightweight protocol for publish/subscribe messaging.
http://www.rubydoc.info/gems/mqtt
MIT License
541 stars 135 forks source link

Avoid 'warning: assigned but unused variable' warn #33

Closed ytti closed 10 years ago

ytti commented 10 years ago

When $VERBOSE is true ruby will log error for unused variables, this error can be suppressed by prefixing variable by '', or having variable named '', which is canonical signal for 'unnecessary'

(refer to commit c9528f6a9e3157b349d3d81d20b9b4047ee9ff63 as well)

njh commented 10 years ago

Sorry I missed this, thanks for the fix

njh commented 10 years ago

Is there a way I can check for these problems automatically? (so that something returns non-zero if there are warnings when $VERBOSE is true?)

ytti commented 10 years ago

At least obvious ones you could do by setting $VERBOSE = true before requiring mqtt in some simple script? Maybe it could be in spec test, if you'd call some example script in popen, which you expect not to print anything and fail test if STDERR gets written to? Dunno, just silly stab in the dark.

At least that is how I've found them accidentally, as I use $VERBOSE when developing my scripts started to puke extra output.