GitHub PullRequestReviewCommentEvent at 2014-01-24 13:46:46
Repository: rubocop
Actor: bbatsov
Payload: {"comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments/9148198","id":9148198,"diff_hunk":"@@ -0,0 +1,74 @@\n+# encoding: utf-8\n+\n+module Rubocop\n+  module Cop\n+    module Lint\n+      # This cop checks for conditional statements where the condition is a\n+      # method call with at least one argument, where no parentheses are used\n+      # around the parameter list, and a boolean operator, && or ||, is used\n+      # in the last argument.\n+      #\n+      # The idea behind warning for these constructs is that the user might\n+      # be under the impression that the return value from the method call is\n+      # an operand of &&/||.\n+      #\n+      # @example\n+      #\n+      # if day.is? :tuesday && month == :jan\n+      #   ...\n+      # end\n+      class RequireParentheses < Cop\n+        include IfNode\n+\n+        MSG = 'Use parentheses in the method call to avoid confusion about ' +\n+          'precedence.'\n+\n+        def on_if(node, offset = 0)\n+          return if ternary_op?(node)","path":"lib/rubocop/cop/lint/require_parentheses.rb","position":27,"original_position":27,"commit_id":"8327e43cf3a77a2ca536f88111a984221d165d41","original_commit_id":"8327e43cf3a77a2ca536f88111a984221d165d41","user":{"login":"bbatsov","id":103882,"avatar_url":"https://gravatar.com/avatar/7710f41976a45c0b25deaf0f2a4577bc?d=https%3A%2F%2Fidenticons.github.com%2Fdceaa0c3804da6d2357baa934f91c119.png&r=x","gravatar_id":"7710f41976a45c0b25deaf0f2a4577bc","url":"https://api.github.com/users/bbatsov","html_url":"https://github.com/bbatsov","followers_url":"https://api.github.com/users/bbatsov/followers","following_url":"https://api.github.com/users/bbatsov/following{/other_user}","gists_url":"https://api.github.com/users/bbatsov/gists{/gist_id}","starred_url":"https://api.github.com/users/bbatsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbatsov/subscriptions","organizations_url":"https://api.github.com/users/bbatsov/orgs","repos_url":"https://api.github.com/users/bbatsov/repos","events_url":"https://api.github.com/users/bbatsov/events{/privacy}","received_events_url":"https://api.github.com/users/bbatsov/received_events","type":"User","site_admin":false},"body":"Why not apply this to the condition of a ternary op as well?","created_at":"2014-01-24T13:46:46Z","updated_at":"2014-01-24T13:46:46Z","html_url":"https://github.com/bbatsov/rubocop/pull/756#discussion_r9148198","pull_request_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/756","_links":{"self":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments/9148198"},"html":{"href":"https://github.com/bbatsov/rubocop/pull/756#discussion_r9148198"},"pull_request":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/756"}}}}