Class: RuboCop::Cop::Primer::ComponentNameMigration
- Defined in:
 - lib/rubocop/cop/primer/component_name_migration.rb
 
Overview
This cop ensures that components don’t use deprecated component names
bad Primer::ComponentNameComponent.new()
good Primer::Beta::ComponentName.new()
Instance Method Summary collapse
Methods inherited from BaseCop
Instance Method Details
#autocorrect(node) ⇒ Object
      25 26 27 28 29 30 31 32 33  | 
    
      # File 'lib/rubocop/cop/primer/component_name_migration.rb', line 25 def autocorrect(node) lambda do |corrector| component_name = node.const_name return unless ::Primer::Deprecations.correctable?(component_name) replacement = ::Primer::Deprecations.replacement(component_name) corrector.replace(node, replacement) if replacement.present? end end  | 
  
#on_send(node) ⇒ Object
      18 19 20 21 22 23  | 
    
      # File 'lib/rubocop/cop/primer/component_name_migration.rb', line 18 def on_send(node) return unless node.method_name == :new && !node.receiver.nil? && ::Primer::Deprecations.deprecated?(node.receiver.const_name) = ::Primer::Deprecations.(node.receiver.const_name) add_offense(node.receiver, message: ) end  |