Skip to content

Commit 4bec0c3

Browse files
committed
Suppress RuboCop's offenses
Follow up rubocop/rubocop#13772
1 parent 41a95ac commit 4bec0c3

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

lib/rubocop/cop/mixin/active_record_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def foreign_key_of(belongs_to)
8787

8888
options.each_pair.find do |pair|
8989
next unless pair.key.sym_type? && pair.key.value == :foreign_key
90-
next unless pair.value.sym_type? || pair.value.str_type?
90+
next unless pair.value.type?(:sym, :str)
9191

9292
break pair.value.value.to_s
9393
end

lib/rubocop/cop/rails/content_tag.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def autocorrect(corrector, node, preferred_method)
7979
end
8080

8181
def allowed_name?(argument)
82-
return false unless argument.str_type? || argument.sym_type?
82+
return false unless argument.type?(:str, :sym)
8383

8484
!/^[a-zA-Z-][a-zA-Z\-0-9]*$/.match?(argument.value)
8585
end

lib/rubocop/cop/rails/inquiry.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Inquiry < Base
2929
def on_send(node)
3030
return unless node.arguments.empty?
3131
return unless (receiver = node.receiver)
32-
return if !receiver.str_type? && !receiver.array_type?
32+
return unless receiver.type?(:str, :array)
3333

3434
add_offense(node.loc.selector)
3535
end

lib/rubocop/cop/rails/pluralization_grammar.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def plural_receiver?(number)
9696
end
9797

9898
def literal_number?(node)
99-
node && (node.int_type? || node.float_type?)
99+
node&.type?(:int, :float)
100100
end
101101

102102
def pluralize(method_name)

lib/rubocop/cop/rails/presence.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def ignore_if_node?(node)
102102
end
103103

104104
def ignore_other_node?(node)
105-
node && (node.if_type? || node.rescue_type? || node.while_type?)
105+
node&.type?(:if, :rescue, :while)
106106
end
107107

108108
def message(node, receiver, other)

lib/rubocop/cop/rails/save_bang.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def operator_or_single_negative?(node)
248248
end
249249

250250
def conditional?(parent)
251-
parent.if_type? || parent.case_type?
251+
parent.type?(:if, :case)
252252
end
253253

254254
def deparenthesize(node)
@@ -305,7 +305,7 @@ def implicit_return?(node)
305305

306306
node = assignable_node(node)
307307
method, sibling_index = find_method_with_sibling_index(node.parent)
308-
return false unless method && (method.def_type? || method.block_type?)
308+
return false unless method&.type?(:def, :block)
309309

310310
method.children.size == node.sibling_index + sibling_index
311311
end
@@ -324,7 +324,7 @@ def argument?(node)
324324

325325
def explicit_return?(node)
326326
ret = assignable_node(node).parent
327-
ret && (ret.return_type? || ret.next_type?)
327+
ret&.type?(:return, :next)
328328
end
329329

330330
def return_value_assigned?(node)

lib/rubocop/cop/rails/strip_heredoc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class StripHeredoc < Base
3333

3434
def on_send(node)
3535
return unless (receiver = node.receiver)
36-
return unless receiver.str_type? || receiver.dstr_type?
36+
return unless receiver.type?(:str, :dstr)
3737
return unless receiver.respond_to?(:heredoc?) && receiver.heredoc?
3838

3939
register_offense(node, receiver)

lib/rubocop/cop/rails/unique_validation_without_index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def include_column_names_in_expression_index?(index, column_names)
7373

7474
def column_names(node, uniqueness_part)
7575
arg = node.first_argument
76-
return unless arg.str_type? || arg.sym_type?
76+
return unless arg.type?(:str, :sym)
7777

7878
ret = [arg.value]
7979
names_from_scope = column_names_from_scope(uniqueness_part)

0 commit comments

Comments
 (0)