Sha256: 6539282d16e3fa88839e812c88a190cf4fceffd3d8e5b86ef3bd3e0b52c89fa3
Contents?: true
Size: 535 Bytes
Versions: 6
Compression:
Stored size: 535 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for nested ternary op expressions. class NestedTernaryOperator < Cop MSG = 'Ternary operators must not be nested. Prefer `if` or `else` ' \ 'constructs instead.'.freeze def on_if(node) return unless node.ternary? node.each_descendant(:if).select(&:ternary?).each do |nested_ternary| add_offense(nested_ternary) end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems