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:
|
|
|
Instance Chain:
|
|
| 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
-
BASE_MESSAGE =
# File 'lib/rubocop/config_obsoletion/removed_cop.rb', line 11'The `%<old_name>s` cop has been removed'
Class Method Summary
- .new(config, old_name, metadata) ⇒ RemovedCop constructor Internal use only
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
- #rule_message Internal use only
- #alternatives private Internal use only
- #reason private Internal use only
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 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