Sha256: 2c9bf158399521d5aa8464908ae3b52ed9f0d04f9a4d0e9c3d0a5b390fb1938b
Contents?: true
Size: 604 Bytes
Versions: 7
Compression:
Stored size: 604 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for multi-line ternary op expressions. class MultilineTernaryOperator < Cop include IfNode MSG = 'Avoid multi-line ternary operators, ' \ 'use `if` or `unless` instead.'.freeze def on_if(node) _condition, _if_branch, else_branch = *node return unless ternary?(node) unless node.loc.line == else_branch.loc.line add_offense(node, :expression) end end end end end end
Version data entries
7 entries across 7 versions & 2 rubygems