lib/rubocop/cop/lint/format_parameter_mismatch.rb in rubocop-0.37.2 vs lib/rubocop/cop/lint/format_parameter_mismatch.rb in rubocop-0.38.0
- old
+ new
@@ -32,23 +32,17 @@
private
def offending_node?(node)
return false unless called_on_string?(node)
+ return false unless sprintf?(node) || format?(node) || percent?(node)
+ return false if named_mode?(node) || node_with_splat_args?(node)
- if sprintf?(node) || format?(node) || percent?(node)
- if named_mode?(node) || node_with_splat_args?(node)
- false
- else
- num_of_format_args, num_of_expected_fields = count_matches(node)
+ num_of_format_args, num_of_expected_fields = count_matches(node)
- num_of_format_args != :unknown &&
- num_of_expected_fields != :unknown &&
- num_of_expected_fields != num_of_format_args
- end
- else
- false
- end
+ num_of_format_args != :unknown &&
+ num_of_expected_fields != :unknown &&
+ num_of_expected_fields != num_of_format_args
end
def called_on_string?(node)
receiver_node, _method, format_string, = *node
if receiver_node.nil? || receiver_node.const_type?