Sha256: cfc714eae70af75aadb51c6761b413fa0617234b4f244b7b0e70ac5f50cf5435
Contents?: true
Size: 498 Bytes
Versions: 9
Compression:
Stored size: 498 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 IfThenElse def offending_line(node) node.loc.expression.line unless node.loc.expression.source =~ /\n/ end def error_message(_node) 'Favor the ternary operator (?:) over if/then/else/end constructs.' end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems