evolve75/RubyTree

Reconsider Using structured_warnings

sshaw opened this issue ยท 8 comments

sshaw commented

structured_warnings overrides warn -and that should scare you. This has caused several problems for us across a couple of codebases that have a dependency on RubyTree. Here's the latest issue: no such dynamic variable: disabled_warnings.

Stacktrace:

/web/releases/working/ROOT/WEB-INF/gems/gems/structured_warnings-0.2.0/lib/structured_warnings/dynamic.rb:26:in `here!'
org/jruby/RubyProc.java:271:in `call'
org/jruby/RubyHash.java:703:in `default'
org/jruby/RubyHash.java:1087:in `[]'
/web/releases/working/ROOT/WEB-INF/gems/gems/structured_warnings-0.2.0/lib/structured_warnings/dynamic.rb:55:in `[]'
/web/releases/working/ROOT/WEB-INF/gems/gems/structured_warnings-0.2.0/lib/structured_warnings.rb:38:in `disabled_warnings'
/web/releases/working/ROOT/WEB-INF/gems/gems/structured_warnings-0.2.0/lib/structured_warnings/warning.rb:54:in `active?'
/web/releases/working/ROOT/WEB-INF/gems/gems/structured_warnings-0.2.0/lib/structured_warnings/kernel.rb:61:in `warn'
/web/releases/working/ROOT/WEB-INF/gems/gems/active_utils-2.2.3/lib/active_utils/common/utils.rb:16:in `deprecated'
/web/releases/working/ROOT/WEB-INF/gems/gems/activemerchant-1.42.9/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb:125:in `credit'

ActiveMerchant is trying to call Kernel#warn but structured_warnings steps in and causes an otherwise non existent problem.

Thanks for reporting this. Will review and remove/isolate the use of structured_warnings.

Yeah, structured_warnings does not seem to work properly:


[fredde@archie noder]$ irb --version
irb 0.9.6(09/06/30)
[fredde@archie noder]$ ruby --version
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
[fredde@archie noder]$ irb
irb(main):001:0> require 'tree'
TypeError: Warning is not a class
	from /home/fredde/.gem/ruby/2.4.0/gems/structured_warnings-0.2.0/lib/structured_warnings/warning.rb:11:in `<top (required)>'
	from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
[...]

@jagenheim , the last issue was resolved by an upgrade for structured_warnings yesterday :)

However the dependency needs to be upgraded to 0.3.0 , currently this gem is dependent on ~> 0.2

any updates on this? Can the dependency to structured_warnings be upgraded please? :)

Sorry for not following up on this. I 'fixed' it by just removing the dependency to structured_warnings and the tree worked fine for what I used it for.

I have since moved on so I have not tried to update to the latest versions.

i understand that @jagenheim , but the question was for the maintainers of this project. Can the dependency be updated please? I really need it .

Sorry for bringing an old issue back to life -- but currently, this gem doesn't support Ruby 2.5 or 2.6 due it its dependency on structured_warnings. Are there any plans to address this?

@dewey4iv and others, happy to report that this issue has been fully resolved in Release 2.0.0, which no longer depends on structured_warnings.

See R2.0.0 release notes for details.