KEMBAR78
Fix `Style/RedundantFormat` handling control characters like `\n` by dvandersluis · Pull Request #14607 · rubocop/rubocop · GitHub
Skip to content

Conversation

@dvandersluis
Copy link
Member

Style/RedundantFormat does not currently handle control characters properly, they need to be kept escaped and not replaced with their actual string representations.

NOTE: \s will be replaced with a space regardless, because that's how Ruby handles \s, it does not keep it as an escape character.

[1] pry(main)> "\s"
=> " "

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.

@dvandersluis dvandersluis force-pushed the redundant-format-control-chars branch from 37a6440 to 340d557 Compare October 16, 2025 20:15
@koic koic merged commit 783a4bf into rubocop:master Oct 17, 2025
22 checks passed
@koic
Copy link
Member

koic commented Oct 17, 2025

Thanks!

@dvandersluis dvandersluis deleted the redundant-format-control-chars branch October 17, 2025 11:45
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.

2 participants