diff --git a/config/default.yml b/config/default.yml index 67176b2d5df5..da0926a636e5 100644 --- a/config/default.yml +++ b/config/default.yml @@ -3129,7 +3129,7 @@ Style/ExpandPathArguments: VersionAdded: '0.53' Style/FlipFlop: - Description: 'Checks for flip flops' + Description: 'Checks for flip-flops' StyleGuide: '#no-flip-flops' Enabled: true VersionAdded: '0.16' diff --git a/lib/rubocop/cop/style/flip_flop.rb b/lib/rubocop/cop/style/flip_flop.rb index d68dc71457b6..085ebf7070a8 100644 --- a/lib/rubocop/cop/style/flip_flop.rb +++ b/lib/rubocop/cop/style/flip_flop.rb @@ -3,7 +3,8 @@ module RuboCop module Cop module Style - # This cop looks for uses of flip flop operator + # This cop looks for uses of flip-flop operator. + # flip-flop operator is deprecated since Ruby 2.6.0. # # @example # # bad @@ -16,7 +17,7 @@ module Style # puts x if (x >= 5) && (x <= 10) # end class FlipFlop < Cop - MSG = 'Avoid the use of flip flop operators.'.freeze + MSG = 'Avoid the use of flip-flop operators.'.freeze def on_iflipflop(node) add_offense(node) diff --git a/manual/cops_style.md b/manual/cops_style.md index feb2ac1a63fd..0374eba459d5 100644 --- a/manual/cops_style.md +++ b/manual/cops_style.md @@ -1895,7 +1895,8 @@ Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChan --- | --- | --- | --- | --- Enabled | Yes | No | 0.16 | - -This cop looks for uses of flip flop operator +This cop looks for uses of flip-flop operator. +flip-flop operator is deprecated since Ruby 2.6.0. ### Examples diff --git a/spec/rubocop/cop/style/flip_flop_spec.rb b/spec/rubocop/cop/style/flip_flop_spec.rb index 5c92864d2f19..cd7eab30d0a1 100644 --- a/spec/rubocop/cop/style/flip_flop_spec.rb +++ b/spec/rubocop/cop/style/flip_flop_spec.rb @@ -3,20 +3,20 @@ RSpec.describe RuboCop::Cop::Style::FlipFlop do subject(:cop) { described_class.new } - it 'registers an offense for inclusive flip flops' do + it 'registers an offense for inclusive flip-flops' do expect_offense(<<-RUBY.strip_indent) DATA.each_line do |line| print line if (line =~ /begin/)..(line =~ /end/) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid the use of flip flop operators. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid the use of flip-flop operators. end RUBY end - it 'registers an offense for exclusive flip flops' do + it 'registers an offense for exclusive flip-flops' do expect_offense(<<-RUBY.strip_indent) DATA.each_line do |line| print line if (line =~ /begin/)...(line =~ /end/) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid the use of flip flop operators. + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid the use of flip-flop operators. end RUBY end