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

[Resolves #91] Invalid characters on suffix #92

Merged

Conversation

rpbaltazar
Copy link
Contributor

Describe the change

On the conversion of the user input, instead of blindly generating the regex for matching based on the configured positive value we ensure that the value for positive is escaped if needed, by invoking Regexp.escape.

Why are we doing this?

Building the regex blindly based on the user suffix param, in case he/she uses characters that conflict with the regex definition itself, it makes the prompt crash.

Benefits

When adding this, the suffix option for the prompt will support characters that otherwise would crash the regex definition.

Drawbacks

None that I can think of

Requirements

Put an X between brackets on each line if you have done the item:
[x] Tests written & passing locally?
[x] Code style checked?
Tried to follow the patterns I've identified in the existing codebase but i might have missed something.
[x] Rebased with master branch?
[] Documentaion updated?
There is no need for updated documentation in my opinion

spec/unit/yes_no_spec.rb Outdated Show resolved Hide resolved
spec/unit/yes_no_spec.rb Outdated Show resolved Hide resolved
spec/unit/yes_no_spec.rb Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Oct 31, 2018

Coverage Status

Coverage increased (+0.008%) to 97.042% when pulling 2f1464f on rpbaltazar:invalid-characters-on-suffix-91 into 0c1ab30 on piotrmurach:master.

@piotrmurach piotrmurach merged commit 1da6513 into piotrmurach:master Oct 31, 2018
@piotrmurach
Copy link
Owner

Thank you! ❤️

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.

None yet

4 participants