class RuboCop::Cop::Style::WhileUntilModifier
The maximum line length is configurable.
if written as a modifier while/until.
Checks for while and until statements that would fit on one line
def check(node)
def check(node) return unless node.loc.end return unless fit_within_line_as_modifier_form?(node) add_offense(node, :keyword, message(node.loc.keyword.source)) end
def message(keyword)
def message(keyword) "Favor modifier `#{keyword}` usage when having a single-line body." end
def on_until(node)
def on_until(node) check(node) end
def on_while(node)
def on_while(node) check(node) end