Sha256: 0f10580dc002cc72fe6879d88a38c43a1916dd2f9d506edbb4fa5d3de7985405
Contents?: true
Size: 526 Bytes
Versions: 15
Compression:
Stored size: 526 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
15 entries across 15 versions & 2 rubygems