Sha256: 94467fcf08db902bf9a5471be248b9afd209d8d75c02de995e853beead629713

Contents?: true

Size: 633 Bytes

Versions: 3

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Style
      # Checks for uses of while with a negated condition.
      class NegatedWhile < Cop
        include NegativeConditional

        def on_while(node)
          check_negative_conditional(node)
        end

        def on_until(node)
          check_negative_conditional(node)
        end

        def autocorrect(node)
          ConditionCorrector.correct_negative_condition(node)
        end

        private

        def message(node)
          format(MSG, inverse: node.inverse_keyword, current: node.keyword)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.54.0 lib/rubocop/cop/style/negated_while.rb
rubocop-0.53.0 lib/rubocop/cop/style/negated_while.rb
rubocop-0.52.1 lib/rubocop/cop/style/negated_while.rb