[#82706] [Ruby trunk Bug#13851] getting "can't modify string; temporarily locked" on non-frozen instances — cardoso_tiago@...
Issue #13851 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/07
[#82853] [Ruby trunk Bug#13916] Race condition when sending a signal to a new fork — russell.davis@...
Issue #13916 has been reported by russelldavis (Russell Davis).
3 messages
2017/09/19
[#82892] [Ruby trunk Bug#13921] buffered read_nonblock doesn't work as expected using SSLSocket — cardoso_tiago@...
Issue #13921 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/20
[ruby-core:82990] [Ruby trunk Feature#13922] Consider showing warning messages about same-named aliases - either directly or perhaps via the "did you mean gem"
From:
zn@...
Date:
2017-09-25 12:21:13 UTC
List:
ruby-core #82990
Issue #13922 has been updated by znz (Kazuhiro NISHIYAMA).
In following example, `ruby -w` warns `alias_after_def` and `duplicated_def` only, but rubocop warns all combinations.
```
% cat /tmp/a.rb
#!/usr/bin/ruby -w
class Foo
def m
end
def alias_after_def
end
alias alias_after_def m
alias def_after_alias m
def def_after_alias
end
alias duplicated_alias m
alias duplicated_alias m
def duplicated_def
end
def duplicated_def
end
end
% ruby -w /tmp/a.rb
/tmp/a.rb:9: warning: method redefined; discarding old alias_after_def
/tmp/a.rb:6: warning: previous definition of alias_after_def was here
/tmp/a.rb:22: warning: method redefined; discarding old duplicated_def
/tmp/a.rb:19: warning: previous definition of duplicated_def was here
% rubocop /tmp/a.rb
Inspecting 1 file
W
Offenses:
/tmp/a.rb:1:1: W: Script file a.rb doesn't have execute permission.
#!/usr/bin/ruby -w
^^^^^^^^^^^^^^^^^^
/tmp/a.rb:2:1: C: Missing top-level class documentation comment.
class Foo
^^^^^
/tmp/a.rb:3:3: C: Put empty method definitions on a single line.
def m ...
^^^^^
/tmp/a.rb:6:3: C: Put empty method definitions on a single line.
def alias_after_def ...
^^^^^^^^^^^^^^^^^^^
/tmp/a.rb:9:3: W: Method Foo#alias_after_def is defined at both /tmp/a.rb:6 and /tmp/a.rb:9.
alias alias_after_def m
^^^^^
/tmp/a.rb:13:3: W: Method Foo#def_after_alias is defined at both /tmp/a.rb:11 and /tmp/a.rb:13.
def def_after_alias
^^^
/tmp/a.rb:13:3: C: Put empty method definitions on a single line.
def def_after_alias ...
^^^^^^^^^^^^^^^^^^^
/tmp/a.rb:17:3: W: Method Foo#duplicated_alias is defined at both /tmp/a.rb:16 and /tmp/a.rb:17.
alias duplicated_alias m
^^^^^
/tmp/a.rb:19:3: C: Put empty method definitions on a single line.
def duplicated_def ...
^^^^^^^^^^^^^^^^^^
/tmp/a.rb:22:3: W: Method Foo#duplicated_def is defined at both /tmp/a.rb:19 and /tmp/a.rb:22.
def duplicated_def
^^^
/tmp/a.rb:22:3: C: Put empty method definitions on a single line.
def duplicated_def ...
^^^^^^^^^^^^^^^^^^
1 file inspected, 11 offenses detected
```
----------------------------------------
Feature #13922: Consider showing warning messages about same-named aliases - either directly or perhaps via the "did you mean gem"
https://bugs.ruby-lang.org/issues/13922#change-66898
* Author: shevegen (Robert A. Heiler)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
I file here rather than at https://github.com/yuki24/did_you_mean because I am not sure
if the site by Yuki Nishijima may be appropriate, so I think first ruby core has to
decide on this.
Consider the following code:
#!/usr/bin/ruby -w
# =========================================================================== #
class Foo
def initialize
unused_variable_warning = 42
bar
end
def bar
puts 'hello from bar'
end; alias bar1 bar
alias bar2 bar
alias bar3 bar
alias bar3 bar
end
Foo.new
The output will be something like:
foo.rb:7: warning: assigned but unused variable - unused_variable_warning
hello from bar
This is all fine. We get a warning, which is good.
My question is: should the same alias name also cause
a warning?
It is probably unimportant because it is an alias to the very same
method anyway, but I was just wondering in general.
In my opinion it may be better to actually also show a warning
similar to unused variables. But I can not say since perhaps
people may prefer to not see any warning - I think that in most
cases, in the above, though, most people may have made a typo
or so. This is actually how I encountered this, I wanted to add
a new alias and noticed that I have had already two other, same
named aliases. It is no big deal but I was only wondering whether
the above behaviour to not show any warning was just an oversight
or whether it is deliberate.
--
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>