Sha256: 8845e3728af7be2e4a2aa4784944d343bcc685849af38fdcb304922346581461
Contents?: true
Size: 513 Bytes
Versions: 2
Compression:
Stored size: 513 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # This cop checks for multi-line ternary op expressions. class MultilineTernaryOperator < Cop MSG = 'Avoid multi-line ?: (the ternary operator); use if/unless instead.' def on_if(node) loc = node.loc # discard non-ternary ops return unless loc.respond_to?(:question) add_offense(node, :expression) if loc.line != loc.colon.line end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.19.1 | lib/rubocop/cop/style/multiline_ternary_operator.rb |
rubocop-0.19.0 | lib/rubocop/cop/style/multiline_ternary_operator.rb |