did_you_mean icon indicating copy to clipboard operation
did_you_mean copied to clipboard

Issues with the did_you_mean deprecation warning

Open eregon opened this issue 2 years ago • 6 comments

I've noticed https://github.com/rubygems/rubygems/issues/5234 as well.

I think there are multiple improvements here:

  • The warning should show the caller, otherwise it's hard to know which gem is causing it (warn msg, uplevel: 1 does that).
  • Since it's a deprecation warning it would be great to only show it when Warning[:deprecated] Of course that only works on Ruby 2.7+, on other versions probably better to show only if $VERBOSE.
  • (warn msg, category: :deprecated would also work but needs Ruby 3+)

eregon avatar Jan 03 '22 10:01 eregon

There is also the question whether it's worth at all to warn for this, given the current code handles it just fine by forwarding to the new method. Having 2 public APIs for the same thing is not ideal, so the warning makes sense for that, but OTOH asking various usages to update just for Ractor support which is likely not used (and would work fine with the old way due to the forwarding) is not ideal either.

eregon avatar Jan 03 '22 10:01 eregon

I noticed the deprecate_constant :SPELL_CHECKERS so we would get a location if Warning[:deprecated] (non-default on 2.7.2+). So maybe no need to show the caller if we only warn when Warning[:deprecated].

eregon avatar Jan 03 '22 10:01 eregon

@eregon do you know if it's somehow possible to find the offensive gem currently in the codebase? I'm getting it in the Rails app and I have no idea how to find it, to report it or fix

morgoth avatar Feb 21 '22 13:02 morgoth

Maybe running after export RUBYOPT=-W:deprecated helps to find out.

eregon avatar Feb 22 '22 14:02 eregon

Thanks, I actually found it today. It was caused by old version of thor gem. The old version was enforced by other gem (license_finder). I found it by quick examination of our gem list versions.

morgoth avatar Feb 22 '22 14:02 morgoth

FWIW my issue was bundler, upgraded to 2.3.9 and fixed the warning.

KidA001 avatar May 09 '22 19:05 KidA001

Thank you all for all the insights and recommendations. Really appreciate the time you all have taken for the conversation here. With all that said, I don't think this is an issue today. I know people (including me) have run into an awkward situation, but this is a problem time will (or possibly have already solved) solve. If anyone runs into this issue. please refer to https://github.com/rubygems/rubygems/issues/5234 for how to fix it.

yuki24 avatar Jan 01 '23 09:01 yuki24