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

Lint/RedundantHeredocDelimiterQuotes: Add spec for escapes #11543

Conversation

splattael
Copy link
Contributor

This commit adds a missing spec to highlight how escapes are handled.

Follow-up of #11528.


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.

@@ -22,7 +22,8 @@ module Style
# EOS
#
# do_something(<<~'EOS')
# escaped character\.
# Preserve \
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 decided to tweak the example because I think it's more common to use quoted heredocs to retain newlines via \.

it 'does not register an offense when using the heredoc delimiter with escapes' do
expect_no_offenses(<<~'RUBY')
do_something(<<~'EOS')
Preserve \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests \\ in STRING_INTERPOLATION_OR_ESCAPED_CHARACTER_PATTERN.

See https://github.com/rubocop/rubocop/pull/11528/files#r1097249283

This commit adds a missing spec to highlight how escapes are handled.

Co-authored-by: Koichi ITO <koic.ito@gmail.com>
@splattael splattael force-pushed the missing-spec-style-redundant-heredoc-delimiter-quotes branch from 649a44b to c94f532 Compare February 6, 2023 15:39
@splattael splattael requested a review from koic February 6, 2023 15:53
@koic koic merged commit d6183ad into rubocop:master Feb 6, 2023
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