Issue #13763 has been updated by Hanmac (Hans Mackowiak).


i am against this, becauese such functions could be used as hookups too for other functions to overwrite them.

like:

~~~ ruby
def xyz
  do_something(temp)
end

def do_something(x)
end
~~~

then something else can overwrite `do_something` with something else and hook to the parameters

ruby does something with functions like `method_defined`

----------------------------------------
Feature #13763: Trigger "unused variable warning" for unused variables in parameter lists
https://bugs.ruby-lang.org/issues/13763#change-65903

* Author: rovf (Ronald Fischer)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Consider the following program nowa.rb:

~~~
def foo(a)
end
%w(x).each {|y|}
foo(1)
z=5
~~~

If I syntax-check it with *ruby -cw nowa.rb* I get the following warning:

~~~
nowa.rb:5: warning: assigned but unused variable - z
~~~

Ruby complains about z, but does not complain about a and y, even though these are also variables which receive a value which never is used. I suggest to issue a warning in these cases too.

Tested with: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-cygwin]



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>