Class: RuboCop::ConfigObsoletion::CopRule Private
- Defined in:
- lib/rubocop/config_obsoletion/cop_rule.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Base class for ConfigObsoletion rules relating to cops
Direct Known Subclasses
Instance Attribute Summary collapse
- #old_name ⇒ Object readonly private
Instance Method Summary collapse
- #cop_rule? ⇒ Boolean private
-
#initialize(config, old_name) ⇒ CopRule
constructor
private
A new instance of CopRule.
- #message ⇒ Object private
- #violated? ⇒ Boolean private
-
#warning? ⇒ Boolean
private
Cop rules currently can only be failures, not warnings.
Methods inherited from Rule
Constructor Details
#initialize(config, old_name) ⇒ CopRule
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CopRule.
10 11 12 13 |
# File 'lib/rubocop/config_obsoletion/cop_rule.rb', line 10 def initialize(config, old_name) super(config) @old_name = old_name end |
Instance Attribute Details
#old_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 |
# File 'lib/rubocop/config_obsoletion/cop_rule.rb', line 8 def old_name @old_name end |
Instance Method Details
#cop_rule? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/rubocop/config_obsoletion/cop_rule.rb', line 15 def cop_rule? true end |
#message ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/rubocop/config_obsoletion/cop_rule.rb', line 19 def + "\n(obsolete configuration found in #{smart_loaded_path}, please update it)" end |
#violated? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/rubocop/config_obsoletion/cop_rule.rb', line 28 def violated? config.key?(old_name) || config.key?(Cop::Badge.parse(old_name).cop_name) end |
#warning? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Cop rules currently can only be failures, not warnings
24 25 26 |
# File 'lib/rubocop/config_obsoletion/cop_rule.rb', line 24 def warning? false end |