123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::ConfigObsoletion::RenamedCop Private

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, CopRule, Rule
Instance Chain:
self, CopRule, Rule
Inherits: RuboCop::ConfigObsoletion::CopRule
Defined in: lib/rubocop/config_obsoletion/renamed_cop.rb

Overview

Encapsulation of a ConfigObsoletion rule for renaming a cop or moving it to a new department.

Class Method Summary

CopRule - Inherited

Rule - Inherited

Instance Attribute Summary

CopRule - Inherited

#cop_rule?, #old_name, #violated?,
#warning?

Cop rules currently can only be failures, not warnings.

Rule - Inherited

#cop_rule?

Does this rule relate to cops?

#parameter_rule?

Does this rule relate to parameters?

#violated?, #config

Instance Method Summary

CopRule - Inherited

Rule - Inherited

Instance Attribute Details

#moved?Boolean (readonly, private)

[ GitHub ]

  
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 22

def moved?
  old_badge = Cop::Badge.parse(old_name)
  new_badge = Cop::Badge.parse(new_name)

  old_badge.department != new_badge.department && old_badge.cop_name == new_badge.cop_name
end

#new_name (readonly)

[ GitHub ]

  
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 9

attr_reader :new_name

Instance Method Details

#rule_message

[ GitHub ]

  
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 16

def rule_message
  "The `#{old_name}` cop has been #{verb} to `#{new_name}`."
end

#verb (private)

[ GitHub ]

  
# File 'lib/rubocop/config_obsoletion/renamed_cop.rb', line 29

def verb
  moved? ? 'moved' : 'renamed'
end