From: "agrimm (Andrew Grimm)" Date: 2013-01-23T15:51:33+09:00 Subject: [ruby-core:51580] [ruby-trunk - Feature #7730][Open] Top level variables aren't checked for assigned but unused behavior Issue #7730 has been reported by agrimm (Andrew Grimm). ---------------------------------------- Feature #7730: Top level variables aren't checked for assigned but unused behavior https://bugs.ruby-lang.org/issues/7730 Author: agrimm (Andrew Grimm) Status: Open Priority: Normal Assignee: Category: Target version: In the following code, variable a in the method gets a warning, but variable b in top level code doesn't get any warning def warning_method a = 2 end b = 2 warning_method $ ruby -w no_toplevel_warnings.rb no_toplevel_warnings.rb:2: warning: assigned but unused variable - a It is possible to detect that b is unused if the script is required from another script. I'd like Ruby to be able to detect that b is an assigned but unused variable. -- http://bugs.ruby-lang.org/