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

Layout/ClosingParenthesisIndentation fails after optimizations #11582

Closed
stoivo opened this issue Feb 16, 2023 · 1 comment · Fixed by #11583
Closed

Layout/ClosingParenthesisIndentation fails after optimizations #11582

stoivo opened this issue Feb 16, 2023 · 1 comment · Fixed by #11583

Comments

@stoivo
Copy link
Contributor

stoivo commented Feb 16, 2023

I upgraded rubocop from 1.32.0 to 1.44.1 and then I started to see the error below.

An error occurred while Layout/ClosingParenthesisIndentation cop was inspecting /Users/simon/dev/work/dodo/fakturabank/repo/db/migrate/20150216145541_fix_signs_for_invoices_in_rec_lin_and_rec_lin_reas.rb:3:27.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop/rubocop/issues

Mention the following information in the issue report:
1.45.1 (using Parser 3.2.1.0, rubocop-ast 1.24.1, running on ruby 3.2.1) [x86_64-darwin20]

After after a little diffing I found out that the actual error is #<RegexpError: too big number for repeat range: /^\s{202433}\S/>. This used to work but I think this commit 2dc325c#diff-fd0332e5689d0ab642df39f706a915663f5d8764d4fa4442d36a291b16de70fb changes to lib/rubocop/cop/util.rb make it fake

#<RegexpError: too big number for repeat range: /^\s{202433}\S/>
["/.../rubocop-1.45.1/lib/rubocop/cop/util.rb:96:in `block in <module:Util>'",
 "/.../rubocop-1.45.1/lib/rubocop/cop/util.rb:101:in `begins_its_line?'",
 "/.../rubocop-1.45.1/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb:123:in `check_for_elements'",
 "/.../rubocop-1.45.1/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb:115:in `check'",
 "/.../rubocop-1.45.1/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb:80:in `on_send'",

I could also see that we have one unreasonable long link 200k line... Do you want the file?

Expected behavior

rubocop should continue to work

Actual behavior

rubocop breaks

Steps to reproduce the problem

run rubocop over a file which has one function call with prentices (but the string need to be longer, it fails when it is 203 000 long I know)

ReconciliationLine.where("parent_type = 'Invoice' and parent_id in (84,83) and amount_with_reasons = 0")

RuboCop version

$ [bundle exec] rubocop -V
1.45.1 (using Parser 3.2.1.0, rubocop-ast 1.24.1, running on ruby 3.2.1) [x86_64-darwin20]
  - rubocop-performance 1.16.0
  - rubocop-rails 2.17.4
  - rubocop-rspec 2.18.1
@stoivo
Copy link
Contributor Author

stoivo commented Feb 23, 2023

Thanks, @fatkodima and @bbatsov. You are awesome!

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 a pull request may close this issue.

1 participant