Sha256: 12c774528c4dd8aa5f1b835b0b2b3f73b7dfa88e160475787f721e69d8fe6351

Contents?: true

Size: 632 Bytes

Versions: 24

Compression:

Stored size: 632 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Style
      # This cop looks for uses of flip flop operator
      #
      # @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 < Cop
        MSG = 'Avoid the use of flip flop operators.'.freeze

        def on_iflipflop(node)
          add_offense(node)
        end

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

Version data entries

24 entries across 22 versions & 3 rubygems

Version Path
rubocop-0.62.0 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.61.1 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.61.0 lib/rubocop/cop/style/flip_flop.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/style/flip_flop.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/style/flip_flop.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/style/flip_flop.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/rubocop-0.60.0/lib/rubocop/cop/style/flip_flop.rb
rubocop-0.60.0 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.59.2 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.59.1 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.59.0 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.58.2 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.58.1 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.58.0 lib/rubocop/cop/style/flip_flop.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/cop/style/flip_flop.rb
rubocop-0.57.2 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.57.1 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.57.0 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.56.0 lib/rubocop/cop/style/flip_flop.rb
rubocop-0.55.0 lib/rubocop/cop/style/flip_flop.rb