8000 `Lint/LiteralInInterpolation`: `/te#{'/'}st/` is autocorrected as `/te/st/` · Issue #13319 · rubocop/rubocop · GitHub
[go: up one dir, main page]

Skip to content
Lint/LiteralInInterpolation: /te#{'/'}st/ is autocorrected as /te/st/ #13319
@stdedos

Description

@stdedos

Expected behavior

Describe here how you expected RuboCop to behave in this particular situation.

Do nothing?

Actual behavior

Describe here what actually happened.
Please use rubocop --debug when pasting rubocop output as it contains additional information.

$ ./rubocop t.rb -a
t.rb:1:5: F: Lint/Syntax: unknown regexp options: t                             
(Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
/te/st/
    ^^
t.rb:1:6: W: [Corrected] Lint/LiteralInInterpolation: Literal interpolation detected.
/te#{'/'}st/
     ^^^
 1/1 file |======================= 100 =======================>| Time: 00:00:01 

1 file inspected, 2 offenses detected, 1 offense corrected

Steps to reproduce the problem

This is extremely important! Providing us with a reliable way to reproduce
a problem will expedite its solution.

require:
  - rubocop-performance

AllCops:
  ActiveSupportExtensionsEnabled: true
  NewCops: enable
  Exclude:
    - 'backend/customer/**/*'

# Disabling because of build issues. See:
# * https://github.com/rubocop/rubocop/discussions/13294
# * https://github.com/rubocop/rubocop/issues/13299
# * https://github.com/rubocop/rubocop/issues/13302
Style/BlockDelimiters:
  Enabled: false

# Minimize git-diff changes, by trying to mimic black:
# https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#how-black-wraps-lines
Layout/MultilineArrayBraceLayout:
  EnforcedStyle: symmetrical

Layout/MultilineArrayLineBreaks:
  Enabled: true

Layout/FirstArrayElementLineBreak:
  Enabled: true

Layout/FirstArrayElementIndentation:
  EnforcedStyle: consistent

Style/TrailingCommaInArrayLiteral:
  EnforcedStyleForMultiline: consistent_comma

Layout/FirstHashElementLineBreak:
  Enabled: true

Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: consistent_comma

Layout/FirstMethodArgumentLineBreak:
  Enabled: true

Layout/ArgumentAlignment:
  EnforcedStyle: with_first_argument

Style/TrailingCommaInArguments:
  EnforcedStyleForMultiline: consistent_comma

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:

$ [bundle exec] rubocop -V
1.66.1 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
  - rubocop-performance 1.22.1
  - rubocop-rspec 3.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0