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/ArgumentsForwarding enforce anonymous bad autocorrect #12875

Open
janklimo opened this issue Apr 29, 2024 · 0 comments
Open

Style/ArgumentsForwarding enforce anonymous bad autocorrect #12875

janklimo opened this issue Apr 29, 2024 · 0 comments
Labels

Comments

@janklimo
Copy link

The following code:

    def validators_on(*args)
      [
        super,
        resource_class.validators_on(*args),
        *@auxiliary_resource_classes.map do |klass|
          klass.validators_on(*args)
        end,
      ].flatten
    end
  end

results in invalid autocorrect output with

Style/ArgumentsForwarding:
  UseAnonymousForwarding: true
  Enabled: true

Expected behavior

    def validators_on(*args)
      [
        super,
        resource_class.validators_on(*args),
        *@auxiliary_resource_classes.map do |klass|
          klass.validators_on(*args)
        end,
      ].flatten
    end
  end

Actual behavior

    def validators_on(*)
      [
        super,
        resource_class.validators_on(*),
        *@auxiliary_resource_classes.map do |klass|
          klass.validators_on(*args)
        end,
      ].flatten
    end
  end

*args will no longer be defined.

Steps to reproduce the problem

Example code above.

RuboCop version

1.63.4 (using Parser 3.3.1.0, rubocop-ast 1.31.2, running on ruby 3.3.1) [arm64-darwin23]
  - rubocop-capybara 2.20.0
  - rubocop-factory_bot 2.25.1
  - rubocop-performance 1.20.2
  - rubocop-rails 2.24.0
  - rubocop-rspec 2.27.1
@koic koic added the bug label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants