Sha256: 6c365d91bb4af3a667494406d6875754db42d41e36f4cfe96efd1c1cbd15226d

Contents?: true

Size: 564 Bytes

Versions: 4

Compression:

Stored size: 564 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)
        end

        def on_until_post(node)
          register_offence(node)
        end

        private

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.12.0 lib/rubocop/cop/lint/loop.rb
rubocop-0.11.1 lib/rubocop/cop/lint/loop.rb
rubocop-0.11.0 lib/rubocop/cop/lint/loop.rb
rubocop-0.10.0 lib/rubocop/cop/lint/loop.rb