Class: Deprecool::Finders::Rails::V8_2_0::InsertUpdateDeleteBinds

Inherits:
Deprecool::Finder
  • Object
show all
Defined in:
lib/deprecool/finders/rails/v8.2.0/no_binds_to_insert_update_delete.rb

Instance Attribute Summary

Attributes inherited from Deprecool::Finder

#file_path, #source

Instance Method Summary collapse

Methods inherited from Deprecool::Finder

affected_version_range, classname, effort, hook_methods, id, #initialize

Methods included from PrismHelpers

#arguments_are_length, #arguments_contain, #unwrap_arguments, #unwrap_array, #unwrap_children, #unwrap_class, #unwrap_parentheses, #value_from_argument

Constructor Details

This class inherits a constructor from Deprecool::Finder

Instance Method Details

#on_call_node(node) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/deprecool/finders/rails/v8.2.0/no_binds_to_insert_update_delete.rb', line 20

def on_call_node(node)
  return unless %i[insert update delete].include?(node.name)
  return unless arguments = unwrap_arguments(node.arguments)
  return unless arguments.length > 1

  confidence = confidence_from_arguments(arguments)
  return if confidence == :none

  add_offense(node, confidence: confidence)
end