Sha256: da8dd9073baf48123a3ad5192102a5fb559f67892694f4364870a0ce975e10c5

Contents?: true

Size: 596 Bytes

Versions: 3

Compression:

Stored size: 596 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Lint
      # This cop checks for uses of *begin...end while/until something*.
      class Loop < Cop
        MSG = 'Use Kernel#loop with break rather than ' +
              'begin/end/until(or while).'

        def on_while_post(node)
          register_offence(node)
          super
        end

        def on_until_post(node)
          register_offence(node)
          super
        end

        private

        def register_offence(node)
          add_offence(:warning, node.loc.keyword, MSG)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
rubocop-0.9.1 lib/rubocop/cop/lint/loop.rb
sabat-rubocop-0.9.0 lib/rubocop/cop/lint/loop.rb
rubocop-0.9.0 lib/rubocop/cop/lint/loop.rb