Sha256: 6de1391f54e756161063f6ed8d8f2631ad34f1f892b783fbc9226c31c9c031c4

Contents?: true

Size: 685 Bytes

Versions: 16

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Lint
      # This cop looks for uses of flip-flop operator.
      # flip-flop operator is deprecated since Ruby 2.6.0.
      #
      # @example
      #   # bad
      #   (1..20).each do |x|
      #     puts x if (x == 5) .. (x == 10)
      #   end
      #
      #   # good
      #   (1..20).each do |x|
      #     puts x if (x >= 5) && (x <= 10)
      #   end
      class FlipFlop < Base
        MSG = 'Avoid the use of flip-flop operators.'

        def on_iflipflop(node)
          add_offense(node)
        end

        def on_eflipflop(node)
          add_offense(node)
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
plaid-14.13.0 vendor/bundle/ruby/3.0.0/gems/rubocop-0.91.1/lib/rubocop/cop/lint/flip_flop.rb
plaid-14.12.1 vendor/bundle/ruby/3.0.0/gems/rubocop-0.91.1/lib/rubocop/cop/lint/flip_flop.rb
plaid-14.12.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.91.1/lib/rubocop/cop/lint/flip_flop.rb
plaid-14.11.1 vendor/bundle/ruby/2.6.0/gems/rubocop-0.91.1/lib/rubocop/cop/lint/flip_flop.rb
plaid-14.10.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.91.1/lib/rubocop/cop/lint/flip_flop.rb
plaid-14.7.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.91.1/lib/rubocop/cop/lint/flip_flop.rb
rubocop-1.0.0 lib/rubocop/cop/lint/flip_flop.rb
rubocop-0.93.1 lib/rubocop/cop/lint/flip_flop.rb
rubocop-0.93.0 lib/rubocop/cop/lint/flip_flop.rb
rubocop-0.92.0 lib/rubocop/cop/lint/flip_flop.rb
rubocop-0.91.1 lib/rubocop/cop/lint/flip_flop.rb
rubocop-0.91.0 lib/rubocop/cop/lint/flip_flop.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.90.0/lib/rubocop/cop/lint/flip_flop.rb
rubocop-0.90.0 lib/rubocop/cop/lint/flip_flop.rb
rubocop-0.89.1 lib/rubocop/cop/lint/flip_flop.rb
rubocop-0.89.0 lib/rubocop/cop/lint/flip_flop.rb