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

Error for Lint/MixedCaseRange when invalid utf8 and offense exists #12750

Open
Earlopain opened this issue Mar 6, 2024 · 0 comments
Open

Error for Lint/MixedCaseRange when invalid utf8 and offense exists #12750

Earlopain opened this issue Mar 6, 2024 · 0 comments

Comments

@Earlopain
Copy link
Contributor

Expected behavior

Offense gets autocorrected.

Actual behavior

RuboCop throws an error. This is because the range for the regexp literals does not contain the correct range.

Steps to reproduce the problem

Note that below is the "em dash", not the usual -.

it 'registers an offense for mixed range with invalid byte sequence in UTF-8' do
  expect_offense(<<~'RUBY'.sub(/\#{message}/, message))
    foo = /[\–A-z]/
              ^^^ #{message}
  RUBY

  expect_correction(<<~'RUBY')
    foo = /[\–A-Za-z]/
  RUBY
end

RuboCop version

$ [bundle exec] rubocop -V
1.62.0 (using Parser 3.3.0.4, rubocop-ast 1.31.1, running on ruby 3.3.0) [x86_64-linux]
  - rubocop-performance 1.20.2
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.27.1
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

No branches or pull requests

1 participant