Support partially dynamic segments #509
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it is
Adds matching for dynamic portions of a segment. This is in addition to the current dynamic matching which matches only entire segments.
Why
Currently, "cats.tenderlove-bio.name" would be marked unused even if the source code contains
t "cats.#{cat}-bio.name"
.Closes #508
How
The library uses two special characters in regex matches right now:
*
and:
. I combined these characters to create a "lazy match" similar the the way you combine.+
and?
to lazily match in standard regular expressions.I created tests which verify that the partial match is only done in a single segment, rather than matching across segments.
Since there isn't currently a way to change which replacement string is used from
":"
, I changed the default value to the new"*:"
.Questions