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

Add new "Arguments Forwarding" rule #845

Merged
merged 1 commit into from
Oct 8, 2020

Commits on Oct 8, 2020

  1. Add new "Arguments Forwarding" rule

    Follow rubocop/rubocop#7646.
    
    This PR adds new "Arguments Forwarding" rule that prefers
    Ruby 2.7's arguments forwarding syntax.
    
    ```ruby
    # bad
    def some_method(*args, &block)
      other_method(*args, &block)
    end
    
    # bad
    def some_method(*args, **kwargs, &block)
      other_method(*args, **kwargs, &block)
    end
    
    # bad
    # Please note that it can cause unexpected incompatible behavior
    # because `...` forwards block also.
    # rubocop/rubocop#7549
    def some_method(*args)
      other_method(*args)
    end
    
    # good
    def some_method(...)
      other_method(...)
    end
    ```
    koic committed Oct 8, 2020
    Configuration menu
    Copy the full SHA
    e48d82a View commit details
    Browse the repository at this point in the history