Sha256: e54328ffaf823e257343231ec8e003dc893fcbc6f1a42151a17a578db89d1b12
Contents?: true
Size: 518 Bytes
Versions: 15
Compression:
Stored size: 518 Bytes
Contents
# encoding: utf-8 module RuboCop module Cop module Style # TODO: Make configurable. # Checks for uses of if/then/else/end on a single line. class OneLineConditional < Cop include OnNormalIfUnless MSG = 'Favor the ternary operator (?:) ' \ 'over if/then/else/end constructs.' def on_normal_if_unless(node) return if node.loc.expression.source.include?("\n") add_offense(node, :expression, MSG) end end end end end
Version data entries
15 entries across 15 versions & 2 rubygems