Shopify / deprecation_toolkit

⚒Eliminate deprecations from your codebase ⚒
MIT License
472 stars 40 forks source link

Override Ruby Warning.warn #3

Closed Edouard-chin closed 6 years ago

Edouard-chin commented 6 years ago

A lot of gems (resque-scheduler, minitest, dogapi ...) doesn't use ActiveSupport::Deprecation and instead just trigger a deprecation using Kernel.warn. We have no way on our side to keep track of these deprecations.

My idea was to implement something similar to the ruby-warning gem and catch any warning that might be deprecations (most of the time the warning is prefixed with the [DEPRECATION] tag) and monkey patch the Warning module to instead use ActiveSupport::Deprecation.warn whenever a deprecation is triggered.

WDYT @rafaelfranca @wvanbergen

wvanbergen commented 6 years ago

I think that makes sense. We probably want to make that opt in though.

Edouard-chin commented 6 years ago

Sounds good, planning to implement that and polish this gem sometimes before June 15th where it's planned to be opensource it as well as talk about it in the engineering blog