[#97678] [Ruby master Feature#16752] :private param for const_set — bughitgithub@...
Issue #16752 has been reported by bughit (bug hit).
5 messages
2020/04/02
[ruby-core:97704] [Ruby master Feature#16755] warning: `if' at the end of line without an expression
From:
shevegen@...
Date:
2020-04-03 23:28:05 UTC
List:
ruby-core #97704
Issue #16755 has been updated by shevegen (Robert A. Heiler).
> You can filter the warnings by overriding Warning.warn, or using the warning gem:
require 'warning'
Warning.ignore(/`(els)?if' at the end of line without an expression/)
That's pretty cool! I did not know that was possible in quite that way. Learned
something there. :D
I think https://ruby-doc.org/core/Warning.html is not the main official docu (I
always mix it up), but I noticed that there was no example for Warning.ignore()
yet. Or perhaps I did not see it. If it is not there yet, perhaps it may be
a useful idea to add it? I didn't know we can already have some control about
at the least some warnings - perhaps I am not the only one. :)
Sorry for distracting here - it's mpapis' request so he may comment if he
would like to. (Personally I do not use this style of if/else, and I also do
not use "then", but I know a few others who used "then", such as apeiros - I
think it may depend a bit on your general ruby style possibly and what people
prefer to use. Warning.ignore() is quite cool, guess I need to test this now!)
----------------------------------------
Feature #16755: warning: `if' at the end of line without an expression
https://bugs.ruby-lang.org/issues/16755#change-84909
* Author: mpapis (Michal Papis)
* Status: Open
* Priority: Normal
----------------------------------------
I'm using this notation in a lot of scripts:
``` ruby
if
true
then
puts :a
else
puts :b
end
```
Using ruby 2.6.5 I'm getting expected response:
``` shell
(0) 2.6.5 mpapis@mpapis-linux:~/tmp>ruby -w test.rb
a
```
Using ruby 2.7.1 I'm getting extra warning:
``` shell
(0) 2.7.1 mpapis@mpapis-linux:~/tmp>ruby -w test.rb
test.rb:1: warning: `if' at the end of line without an expression
a
```
I've tracked it to the following git commits:
* ba35c14325ebbf1da8f200df83c45ee9937ff8a1
* c303854e134043d905baff2385add44cc2c28756
* 26316cc350109ba71d42f944f3b976985627c042
* e91e3274bebc803b97971ad0a6f4ee3a8c646a60
* a087e027bf7cf0fbb825f1d55668f85ab1f3c9e6
* 30a74aaef00a99364f5423439ac44babf5066dc0
--
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>