Class: Deprecool::Finders::Rails::V8_2_0::WriteAttributeId

Inherits:
Deprecool::Finder show all
Defined in:
lib/deprecool/finders/rails/v8.2.0/write_attribute_id.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, inherited, #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



19
20
21
22
23
24
25
# File 'lib/deprecool/finders/rails/v8.2.0/write_attribute_id.rb', line 19

def on_call_node(node)
  return unless node.name == :write_attribute
  return unless arguments_are_length(node.arguments, 2)
  return unless arguments_contain(node.arguments, "id", position: 0)

  add_offense(node, confidence: :high)
end