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 a false positive for Layout/SingleLineBlockChain #10063

Commits on Sep 4, 2021

  1. Fix a false positive for Layout/SingleLineBlockChain

    This PR fixes the following incorrect auto-correct for `Layout/SingleLineBlockChain`
    when method call chained on a new line after a single line block with trailing dot.
    
    It also fixes the following incorrect auto-correction between `Layout/SingleLineBlockChain`
    and `Layout/DotPosition` cops.
    
    ```console
    % cat example.rb
    example.select { |item| item.cond? }.
            join('-')
    % ruby -c example.rb
    Syntax OK
    % bundle exec rubocop -a --only Layout/DotPosition,Layout/SingleLineBlockChain example.rb
    
    % cat example.rb
    example.select { |item| item.cond? }
    
            .join('-')
    % ruby -c example.rb
    example.rb:3: syntax error, unexpected '.', expecting end-of-input
            .join('-')
    ```
    koic committed Sep 4, 2021
    Copy the full SHA
    e834c82 View commit details
    Browse the repository at this point in the history