Sha256: 699b0ff4d5fe5e7900dc1a89efb0b88dabcf16915e62d98726085e3880ea123f
Contents?: true
Size: 761 Bytes
Versions: 54
Compression:
Stored size: 761 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for multi-line ternary op expressions. # # @example # # bad # a = cond ? # b : c # a = cond ? b : # c # a = cond ? # b : # c # # # good # a = cond ? b : c # a = # if cond # b # else # c # end class MultilineTernaryOperator < Cop MSG = 'Avoid multi-line ternary operators, ' \ 'use `if` or `unless` instead.' def on_if(node) return unless node.ternary? && node.multiline? add_offense(node) end end end end end
Version data entries
54 entries across 35 versions & 5 rubygems