Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize paths in deprecation messages #60

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

sambostock
Copy link
Contributor

@sambostock sambostock commented Mar 11, 2022

Summary

This (tentatively) adds support for registering deprecation message normalizers, and provides built in normalization of paths by looking for the following strings:

  • appearances of Dir.pwd, which are replaced with #{Dir.pwd}
  • appearances of any of Gem.path's paths, which are replaced with #{Gem.path[index]}, where index is the index of the path in the Gem.path array

Replacements are made to look like interpolation, so it is clear what they represent.

This should resolve #48.

⚠️ Before Merging

  • Validate approach
    • Should normalizers be expected to mutate the message (to avoid duplicate string allocations), or is it clearer if they return the normalized message (at the cost of creating duplicate objects)?
  • Write tests
  • Consider other safe built in replacements that may have been missed.
    • What happens if a gem is sourced from somewhere non standard? e.g. GitHub? Path?
  • Document new config in README.md
  • Update CHANGELOG.md

Without capturing logs, the warning makes it to stderr. By capturing, we can
not only assert that it would have made it, but prevent it from actually
appearing in the test output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI and local ruby keyword args YAMLs don't match
1 participant