123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::ConfigObsoletion::RemovedCop 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/removed_cop.rb

Overview

Encapsulation of a ConfigObsoletion rule for removing a previously defined cop.

Constant Summary

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

#metadata (readonly)

[ GitHub ]

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

attr_reader :old_name, :

#old_name (readonly)

[ GitHub ]

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

attr_reader :old_name, :

Instance Method Details

#alternatives (private)

[ GitHub ]

  
# File 'lib/rubocop/config_obsoletion/removed_cop.rb', line 36

def alternatives
  Array(['alternatives']).map { |name| "`#{name}`" }
end

#reason (private)

[ GitHub ]

  
# File 'lib/rubocop/config_obsoletion/removed_cop.rb', line 32

def reason
  ['reason']
end

#rule_message

[ GitHub ]

  
# File 'lib/rubocop/config_obsoletion/removed_cop.rb', line 18

def rule_message
  base = format(BASE_MESSAGE, old_name: old_name)

  if reason
    "#{base} since #{reason.chomp}."
  elsif alternatives
    "#{base}. Please use #{to_sentence(alternatives, connector: 'and/or')} instead."
  else
    "#{base}."
  end
end