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

Fix FIELD_REGEX for Lint/FormatParameterMismatch #4618

Merged
merged 1 commit into from
Aug 1, 2017

Conversation

barthez
Copy link
Contributor

@barthez barthez commented Jul 19, 2017

Regex was missing escape for . (dot) and it was matching CGI-escaped left bracket used in format calls.

@@ -85,6 +85,10 @@
expect_no_offenses("format('%s %s %% %s %%%% %%%%%%', 1, 2, 3)")
end

it 'correctly ignores CGI escaped brackets' do
expect_no_offenses("format('%s%%5B%s%%5D=%s', 'name', 'key', 'value')")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case is too complicated.I think format("%s%%5B", 'name') is enough.
And the description (correctly ignores ...) should be changed because the problem is not limited to CGI.
WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just extend test case above with %%5B, would it be ok?

@pocke
Copy link
Collaborator

pocke commented Jul 20, 2017

Good catch!
Could you add an entry to the CHANGELOG? https://github.com/bbatsov/rubocop/blob/master/CHANGELOG.md

Regex was missing escape for . (dot) and it was matching CGI-escaped left
bracket used in format calls.
@barthez
Copy link
Contributor Author

barthez commented Jul 26, 2017

@pocke I have no idea where those failures come from, definitely not from my changes. Can we merge it like this?

@bbatsov
Copy link
Collaborator

bbatsov commented Jul 26, 2017

@barthez It's good that you're well connected.

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.

3 participants