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

Fix an error for Layout/HeredocArgumentClosingParenthesis #11579

Commits on Feb 14, 2023

  1. Fix an error for Layout/HeredocArgumentClosingParenthesis

    This PR fixes an error for `Layout/HeredocArgumentClosingParenthesis`
    when heredoc is a method argument in a parenthesized block argument:
    
    ```ruby
    foo(bar do
      baz <<~EOS
      EOS
    end)
    ```
    
    ```console
    % bundle exec rubocop --only Layout/HeredocArgumentClosingParenthesis
    (snip)
    
    undefined method `begin_pos' for nil:NilClass
    /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/
    heredoc_argument_closing_parenthesis.rb:220:in `exist_argument_between_heredoc_end_and_closing_parentheses?'
    /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/
    heredoc_argument_closing_parenthesis.rb:73:in `on_send'
    /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/commissioner.rb:107:in `public_send'
    ```
    koic committed Feb 14, 2023
    Configuration menu
    Copy the full SHA
    5674174 View commit details
    Browse the repository at this point in the history