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

Style/MethodCallWithArgsParentheses and Style/SuperWithArgsParentheses cause an infinite loop #12596

Closed
rickselby opened this issue Jan 6, 2024 · 2 comments

Comments

@rickselby
Copy link
Contributor

When omitting parentheses with Style/MethodCallWithArgsParentheses, it is not possible to also use Style/SuperWithArgsParentheses as this causes an infinite loop


Expected behavior

Rubocop does not crash! And probably leaves super with parentheses.

There could possibly be support in Style/MethodCallWithArgsParentheses for a list of methods that are allowed parentheses when EnforcedStyle is omit_parentheses? It's possible to do the reverse when enforcing parentheses.

Actual behavior

Infinite loop detected in code.rb and caused by Style/SuperWithArgsParentheses -> Style/MethodCallWithArgsParentheses

Steps to reproduce the problem

.rubocop.yml

Style/MethodCallWithArgsParentheses:
  Enabled: true
  EnforcedStyle: omit_parentheses

Style/SuperWithArgsParentheses:
  Enabled: true

code.rb

class Class1
  def initialize(foo)
    @foo = foo
  end
end

class Class2 < Class1
  def initialize(foo)
    super foo
    bar
  end
end

RuboCop version

$ rubocop -V
1.59.0 (using Parser 3.3.0.0, rubocop-ast 1.30.0, running on ruby 3.3.0) +server [x86_64-linux]
@koic
Copy link
Member

koic commented Jan 6, 2024

This issue is a dup with #12437.

@koic koic closed this as completed Jan 6, 2024
@koic koic added the duplicate label Jan 6, 2024
@rickselby
Copy link
Contributor Author

Sorry - I should have searched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants