Skip to content

Auto-correction of Style/ArgumentsForwarding removes required parameters #14390

@daniel-rikowski

Description

@daniel-rikowski

I have this code:

def render(component, *, **, &)
  if component.is_a?(Middleman::ViewComponents::Components::Base)
    component.render_in(self, *, **, &)
  else
    super
  end
end

I let rubocop auto-correct it.

Expected behavior

It should be auto-corrected to:

def render(component, ...)
  if component.is_a?(Middleman::ViewComponents::Components::Base)
    component.render_in(self, ...)
  else
    super
  end
end

Actual behavior

Instead, the additional parameter self is removed. (component is kept)

def render(component, ...)
  if component.is_a?(Middleman::ViewComponents::Components::Base)
    component.render_in(...) # <== self is gone
  else
    super
  end
end

RuboCop version

1.79.0 (using Parser 3.3.9.0, Prism 1.4.0, rubocop-ast 1.46.0, analyzing as Ruby 3.4, running on ruby 3.4.5) [x64-mingw-ucrt]
  - rubocop-performance 1.25.0
  - rubocop-rake 0.7.1

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