Skip to content

Style/SuperArguments: false negative on calls with blocks #13601

@akimd

Description

@akimd

Hi!

Expected behavior

In the following piece of code, both calls to super need not explicit arguments.

class Base
  def fun(code)
    use(code)
  end
end

class Derived < Base
  def fun(code)
    super(code).foo
    super(code).foo { |props| props }
  end
end

Actual behavior

It complains only about the call without block.

$ bundle exec rubocop rubocop/super.rb
Inspecting 1 file
C

Offenses:

rubocop/super.rb:1:1: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
class Base
^
rubocop/super.rb:9:5: C: [Correctable] Style/SuperArguments: Call super without arguments and parentheses when the signature is identical.
    super(code).foo
    ^^^^^^^^^^^

1 file inspected, 2 offenses detected, 2 offenses autocorrectable

Steps to reproduce the problem

See above.

RuboCop version

$ bundle exec rubocop -V
1.69.2 (using Parser 3.3.6.0, rubocop-ast 1.36.2, analyzing as Ruby 3.3, running on ruby 3.3.6) [arm64-darwin23]
  - rubocop-minitest 0.36.0
  - rubocop-performance 1.23.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy