Sha256: 2fd35a192017bea5bd4073f8dbfd92a2729d31b6ec8da61732d042b132c66e09
Contents?: true
Size: 579 Bytes
Versions: 4
Compression:
Stored size: 579 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop class Loop < Cop MSG = 'Use Kernel#loop with break rather than begin/end/until(or while).' def on_while(node) check(node) super end def on_until(node) check(node) super end private def check(node) _cond, body = *node type = node.type.to_s if body.type == :begin && !node.loc.expression.source.start_with?(type) add_offence(:warning, node.loc.keyword.line, MSG) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.8.3 | lib/rubocop/cop/loop.rb |
rubocop-0.8.2 | lib/rubocop/cop/loop.rb |
rubocop-0.8.1 | lib/rubocop/cop/loop.rb |
rubocop-0.8.0 | lib/rubocop/cop/loop.rb |