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 rubocop#11180] Fix Style/RedundantRegexpEscape bug when regexp provided within %r{...} literal #11395

Merged
merged 1 commit into from
Jan 7, 2023

Conversation

si-lens
Copy link
Contributor

@si-lens si-lens commented Jan 5, 2023

In #11152 i added catching of redundant hyphen escape within character class.
It turned out this can cause SyntaxError due to the corrected Regexp when it is provided using %r{...} literal.


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.

@si-lens si-lens force-pushed the fix_redundant_regexp_escape_bug branch 2 times, most recently from a1c4888 to 5629d1e Compare January 6, 2023 09:27
@si-lens si-lens marked this pull request as ready for review January 6, 2023 10:04
CHANGELOG.md Outdated
@@ -28,6 +28,7 @@
* [#11330](https://github.com/rubocop/rubocop/pull/11330): Fix an error for `Style/RequireOrder` when using `require` inside `rescue` body. ([@fatkodima][])
* [#8751](https://github.com/rubocop/rubocop/issues/8751): Accept `super` within ranges for `Layout/SpaceAroundKeyword` cop. ([@fatkodima][])
* [#10194](https://github.com/rubocop/rubocop/issues/10194): Accept bracketed arrays within 2d arrays containing subarrays with complex content for `Style/WordArray` cop. ([@fatkodima][])
* [#11180](https://github.com/rubocop/rubocop/issues/11180): Fix an error for `Style/RedundantRegexpEscape` when using `%r` to provide regexp expressions. ([@si-lens][])
Copy link
Member

Choose a reason for hiding this comment

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

Can you write the changelog entry with the below instead?

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, it's done.

@si-lens si-lens force-pushed the fix_redundant_regexp_escape_bug branch from 49e4120 to f0ff982 Compare January 7, 2023 17:37
@koic koic merged commit 6d37149 into rubocop:master Jan 7, 2023
@koic
Copy link
Member

koic commented Jan 7, 2023

Thanks!

koic added a commit to koic/rubocop that referenced this pull request Feb 10, 2023
Occasionally I review direct edit to the CHANGELOG.md:

- rubocop#11559 (comment)
- rubocop#11406 (comment)
- rubocop#11395 (comment)

It might be communicated a little more efficiently if listed in the CHANGELOG.md.
And the triple dash for commenting out is used intentionally.
https://stackoverflow.com/questions/4823468/comments-in-markdown/4829998#4829998

It affects when markdown is viewed on GitHub. This is unnecessary note for
user viewing the CHANGELOG.md on GitHub.

Also add changelog/.gitkeep to prevent dead link after release.
bbatsov pushed a commit that referenced this pull request Feb 11, 2023
Occasionally I review direct edit to the CHANGELOG.md:

- #11559 (comment)
- #11406 (comment)
- #11395 (comment)

It might be communicated a little more efficiently if listed in the CHANGELOG.md.
And the triple dash for commenting out is used intentionally.
https://stackoverflow.com/questions/4823468/comments-in-markdown/4829998#4829998

It affects when markdown is viewed on GitHub. This is unnecessary note for
user viewing the CHANGELOG.md on GitHub.

Also add changelog/.gitkeep to prevent dead link after release.
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