Sha256: 18e55f5666734eb15c7383eb998637fa6485e4f5ebbdfe8e69831a19727c9688
Contents?: true
Size: 777 Bytes
Versions: 1
Compression:
Stored size: 777 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop class ParenthesesAroundCondition < Cop MSG = "Don't use parentheses around the condition of an " + 'if/unless/while/until, unless the condition contains an assignment.' def on_if(node) process_control_op(node) super end def on_while(node) process_control_op(node) super end def on_until(node) process_control_op(node) super end private def process_control_op(node) cond, _body = *node cond_source = cond.loc.expression.source if cond_source.start_with?('(') && cond_source.end_with?(')') add_offence(:convetion, cond.loc.line, MSG) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.8.1 | lib/rubocop/cop/parentheses_around_condition.rb |