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 negative for Style/OperatorMethodCall #11379

Commits on Jan 3, 2023

  1. Fix a false negative for Style/OperatorMethodCall

    This PR fixes a false negative for `Style/OperatorMethodCall`
    when using `a.+ b.something`.
    
    The following is the difference depending on whether there is the dot or not.
    
    It is the same when the argument is not enclosed in parentheses:
    
    ```console
    % ruby-parse -e "a.+ b.something"
    (send
      (send nil :a) :+
      (send
        (send nil :b) :something))
    
    % ruby-parse -e "a + b.something"
    (send
      (send nil :a) :+
      (send
        (send nil :b) :something))
    ```
    
    It is different when the argument is enclosed in parentheses.
    
    ```console
    % ruby-parse -e "a.+(b).something"
    (send
      (send
        (send nil :a) :+
        (send nil :b)) :something)
    
    % ruby-parse -e "a +(b).something"
    (send nil :a
      (send
        (send
          (begin
            (send nil :b)) :something) :+@))
    ```
    
    So the former should be warned by this cop.
    koic committed Jan 3, 2023
    Configuration menu
    Copy the full SHA
    0c3a67a View commit details
    Browse the repository at this point in the history