Skip to content

Commit 0d43a61

Browse files
committed
Suppress RuboCop offenses
This commit suppresses the following RuboCop offenses: ```console $ bundle exec rubocop (snip) Offenses: lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb:52:9: C: [Correctable] Style/DirectiveScope: Use disable-next instead of a disable/enable pair around a single statement. # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/rubocop/cop/performance/collection_literal_in_loop.rb:112:9: C: [Correctable] Style/DirectiveScope: Use disable-next instead of a disable/enable pair around a single statement. # rubocop:disable Metrics/CyclomaticComplexity ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/rubocop/cop/performance/compare_with_block.rb:90:9: C: [Correctable] Style/DirectiveScope: Use disable-next instead of a disable/enable pair around a single statement. # rubocop:disable Metrics/MethodLength ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (snip) ```
1 parent 72eb77d commit 0d43a61

12 files changed

Lines changed: 14 additions & 28 deletions

lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BigDecimalWithNumericArgument < Base
4949
(send [!nil? ${float_type? str_type?}] :to_d ...)
5050
PATTERN
5151

52-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
52+
# rubocop:disable-next Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
5353
def on_send(node)
5454
if (numeric = big_decimal_with_numeric_argument(node))
5555
if numeric.numeric_type?
@@ -75,7 +75,6 @@ def on_send(node)
7575
end
7676
end
7777
end
78-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
7978
end
8079
end
8180
end

lib/rubocop/cop/performance/collection_literal_in_loop.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def check_literal?(node, method, arguments)
109109

110110
# Since Ruby 3.4, simple arguments to Array#include? are optimized.
111111
# See https://github.com/ruby/ruby/pull/12123 for more details.
112-
# rubocop:disable Metrics/CyclomaticComplexity
112+
# rubocop:disable-next Metrics/CyclomaticComplexity
113113
def optimized_array_include?(node, method, arguments)
114114
return false unless target_ruby_version >= 3.4 && node.array_type? && method == :include?
115115
# Disallow include?(1, 2)
@@ -125,7 +125,6 @@ def optimized_array_include?(node, method, arguments)
125125
end
126126
ARRAY_INCLUDE_OPTIMIZED_TYPES.include?(arg.type)
127127
end
128-
# rubocop:enable Metrics/CyclomaticComplexity
129128

130129
def nonmutable_method_of_array_or_hash?(node, method)
131130
(node.array_type? && ARRAY_METHODS.include?(method)) ||

lib/rubocop/cop/performance/compare_with_block.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def slow_compare?(method, args_a, args_b)
8787
true
8888
end
8989

90-
# rubocop:disable Metrics/MethodLength
90+
# rubocop:disable-next Metrics/MethodLength
9191
def message(send, method, var_a, var_b, args)
9292
compare_method = send.method_name
9393
replacement_method = REPLACEMENT[compare_method]
@@ -109,7 +109,6 @@ def message(send, method, var_a, var_b, args)
109109
str_a: str_a,
110110
str_b: str_b)
111111
end
112-
# rubocop:enable Metrics/MethodLength
113112

114113
def compare_range(send, node)
115114
range_between(send.loc.selector.begin_pos, node.loc.end.end_pos)

lib/rubocop/cop/performance/delete_prefix.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class DeletePrefix < Base
6767
(call $!nil? ${:gsub :gsub! :sub :sub!} (regexp (str $#literal_at_start?) (regopt)) (str $_))
6868
PATTERN
6969

70-
# rubocop:disable Metrics/AbcSize
70+
# rubocop:disable-next Metrics/AbcSize
7171
def on_send(node)
7272
return unless (receiver, bad_method, regexp_str, replace_string = delete_prefix_candidate?(node))
7373
return unless replace_string.empty?
@@ -86,7 +86,6 @@ def on_send(node)
8686
corrector.replace(node, new_code)
8787
end
8888
end
89-
# rubocop:enable Metrics/AbcSize
9089
alias on_csend on_send
9190
end
9291
end

lib/rubocop/cop/performance/delete_suffix.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class DeleteSuffix < Base
6767
(call $!nil? ${:gsub :gsub! :sub :sub!} (regexp (str $#literal_at_end?) (regopt)) (str $_))
6868
PATTERN
6969

70-
# rubocop:disable Metrics/AbcSize
70+
# rubocop:disable-next Metrics/AbcSize
7171
def on_send(node)
7272
return unless (receiver, bad_method, regexp_str, replace_string = delete_suffix_candidate?(node))
7373
return unless replace_string.empty?
@@ -86,7 +86,6 @@ def on_send(node)
8686
corrector.replace(node, new_code)
8787
end
8888
end
89-
# rubocop:enable Metrics/AbcSize
9089
alias on_csend on_send
9190
end
9291
end

lib/rubocop/cop/performance/map_method_chain.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def on_send(node)
6868

6969
private
7070

71-
# rubocop:disable Metrics/CyclomaticComplexity
71+
# rubocop:disable-next Metrics/CyclomaticComplexity
7272
def find_begin_of_chained_map_method(node, map_args)
7373
return unless (chained_map_method = node.receiver)
7474
return if !chained_map_method.call_type? || !RESTRICT_ON_SEND.include?(chained_map_method.method_name)
@@ -82,7 +82,6 @@ def find_begin_of_chained_map_method(node, map_args)
8282

8383
find_begin_of_chained_map_method(chained_map_method, map_args)
8484
end
85-
# rubocop:enable Metrics/CyclomaticComplexity
8685
end
8786
end
8887
end

lib/rubocop/cop/performance/redundant_sort_block.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ class RedundantSortBlock < Base
1818

1919
MSG = 'Use `sort` without block.'
2020

21-
# rubocop:disable InternalAffairs/ItblockHandler -- `it` block accepts only a single block parameter.
21+
# rubocop:disable-next InternalAffairs/ItblockHandler -- `it` block accepts only a single block parameter.
2222
def on_block(node)
2323
return unless (send, var_a, var_b, body = sort_with_block?(node))
2424

2525
replaceable_body?(body, var_a, var_b) do
2626
register_offense(send, node)
2727
end
2828
end
29-
# rubocop:enable InternalAffairs/ItblockHandler
3029

3130
def on_numblock(node)
3231
return unless (send, arg_count, body = sort_with_numblock?(node))

lib/rubocop/cop/performance/sort_reverse.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ class SortReverse < Base
1919

2020
MSG = 'Use `%<prefer>s` instead.'
2121

22-
# rubocop:disable InternalAffairs/ItblockHandler -- `it` block accepts only a single block parameter.
22+
# rubocop:disable-next InternalAffairs/ItblockHandler -- `it` block accepts only a single block parameter.
2323
def on_block(node)
2424
sort_with_block?(node) do |send, var_a, var_b, body|
2525
replaceable_body?(body, var_b, var_a) do
2626
register_offense(send, node)
2727
end
2828
end
2929
end
30-
# rubocop:enable InternalAffairs/ItblockHandler
3130

3231
def on_numblock(node)
3332
sort_with_numblock?(node) do |send, arg_count, body|

lib/rubocop/cop/performance/squeeze.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Squeeze < Base
3535
(str $_))
3636
PATTERN
3737

38-
# rubocop:disable Metrics/AbcSize
38+
# rubocop:disable-next Metrics/AbcSize
3939
def on_send(node)
4040
squeeze_candidate?(node) do |receiver, bad_method, regexp_str, replace_str|
4141
regexp_str = regexp_str[0..-2] # delete '+' from the end
@@ -57,7 +57,6 @@ def on_send(node)
5757
end
5858
end
5959
end
60-
# rubocop:enable Metrics/AbcSize
6160
alias on_csend on_send
6261

6362
private

lib/rubocop/cop/performance/string_include.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class StringInclude < Base
3333
(send (regexp (str $#literal?) (regopt)) :=~ $_)}
3434
PATTERN
3535

36-
# rubocop:disable Metrics/AbcSize
36+
# rubocop:disable-next Metrics/AbcSize
3737
def on_send(node)
3838
return unless (receiver, regex_str = redundant_regex?(node))
3939

@@ -50,7 +50,6 @@ def on_send(node)
5050
corrector.replace(node, new_source)
5151
end
5252
end
53-
# rubocop:enable Metrics/AbcSize
5453
alias on_csend on_send
5554
alias on_match_with_lvasgn on_send
5655

0 commit comments

Comments
 (0)