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

Make Style/RedundantPercentQ handle multiline source safely #12789

Merged
merged 1 commit into from Mar 15, 2024

Conversation

boardfish
Copy link
Contributor

@boardfish boardfish commented Mar 13, 2024

The regex used in Style/RedundantPercentQ is not resilient to multiline input, meaning that its autocorrect would unsafely operate on strings defined across multiple lines with %Q where these used quotes. This PR changes the anchors on the regex used by the cop so that its autocorrect determines the correct delimiter safely.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@boardfish boardfish force-pushed the redundant-percent-q-multiline branch from fe704f3 to 0c0d88e Compare March 13, 2024 17:07
@boardfish boardfish marked this pull request as ready for review March 13, 2024 17:08
@boardfish boardfish force-pushed the redundant-percent-q-multiline branch from 0c0d88e to 1d1fba4 Compare March 14, 2024 09:05
@boardfish boardfish force-pushed the redundant-percent-q-multiline branch from 1d1fba4 to 72bea19 Compare March 15, 2024 10:54
@koic koic merged commit 9dd0792 into rubocop:master Mar 15, 2024
33 checks passed
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

2 participants