-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Empty string replacement (--replace ""
) is interpreted as absence of parameter
#117
Comments
That's indeed the case: The same CLI as above, without the
|
--replace
with empty string is polluted by non-matching rule--replace ""
) is considered as absence of --replace
parameter
--replace ""
) is considered as absence of --replace
parameter--replace ""
) is considered as absence of parameter
--replace ""
) is considered as absence of parameter--replace ""
) is interpreted as absence of parameter
Thanks for noticing this. I should be able to tackle this tomorrow. |
Only a missing replacement value will trigger one of the fallback options. Fixes #117
Thanks @coordt for the fix! I can confirm v0.16.1 fix this issue! 🎉 |
Description
A simple search and replace of plain string by an empty one is polluted by non-matching rules from the configuration file.
This is a follow-up of #70.
What I Did
Here are my files:
pyproject.toml
:changelog.md
:Here I'm trying to replace the
profanity
string byXXX
with this CLI invokation, and it works:It works as expected, with the only small annoyance that the replacement action seems to be called twice. Maybe this is just a detail of the way the replacement action is reported, or it might indicate a trickier problem. Anyway.
Now instead of
XXX
, I want to remove theprofanity
entirely, and replace it by an empty string.So here I call the same CLI as above, but use the
--replace ""
option instead:I expect there the changed line in
./changelog.md
to be- Test .
, but instead, I get two conflicting results:profanity
is replaced by the current version (2.21.1
)profanity
is replaced by the unrelatedblah_blah_blah
string that has been hard-coded in thepyproject.toml
fileBy the nature of this edge-case, it feels like somewhere in the code path, the empty string passed to
--replace
is normalized toNone
, as if--replace
hasn't been used at all.The text was updated successfully, but these errors were encountered: