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/SpaceAroundOperators #10054

Commits on Aug 27, 2021

  1. Fix a false positive for Layout/SpaceAroundOperators

    This PR fixes a false positive for `Layout/SpaceAroundOperators`
    when match operators between `<<` and `+=`.
    
    This change makes the following behavior consistent:
    
    ## before
    
    Does not register an offense when aligned between `<<`.
    
    ```consle
    % cat example.rb
    # It does not register an offense.
    x  << foo
    yz << bar
    ```
    
    An offense is registered when either is updated to `+=`.
    
    ```console
    % cat example.rb
    # It does not register an offense.
    x  << foo
    yz += bar
    
    % bundle exec rubocop --only Layout/SpaceAroundOperators
    (snip)
    
    example.rb:2:4: C: [Correctable] Layout/SpaceAroundOperators: Operator
    << should be surrounded by a single space.
    x  << foo
    ^^
    
    1 file inspected, 1 offense detected, 1 offense auto-correctable
    ```
    
    ## After
    
    Both does not register an offense.
    koic committed Aug 27, 2021
    Copy the full SHA
    84a123a View commit details
    Browse the repository at this point in the history