Class: RuboCop::ConfigObsoletion Private
- Inherits:
-
Object
- Object
- RuboCop::ConfigObsoletion
- Defined in:
- lib/rubocop/config_obsoletion.rb,
lib/rubocop/config_obsoletion/rule.rb,
lib/rubocop/config_obsoletion/cop_rule.rb,
lib/rubocop/config_obsoletion/split_cop.rb,
lib/rubocop/config_obsoletion/removed_cop.rb,
lib/rubocop/config_obsoletion/renamed_cop.rb,
lib/rubocop/config_obsoletion/extracted_cop.rb,
lib/rubocop/config_obsoletion/parameter_rule.rb,
lib/rubocop/config_obsoletion/changed_parameter.rb,
lib/rubocop/config_obsoletion/changed_enforced_styles.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.
This class handles obsolete configuration.
Defined Under Namespace
Classes: ChangedEnforcedStyles, ChangedParameter, CopRule, ExtractedCop, ParameterRule, RemovedCop, RenamedCop, Rule, SplitCop
Constant Summary collapse
- DEFAULT_RULES_FILE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
File.join(ConfigLoader::RUBOCOP_HOME, 'config', 'obsoletion.yml')
- COP_RULE_CLASSES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ 'renamed' => RenamedCop, 'removed' => RemovedCop, 'split' => SplitCop, 'extracted' => ExtractedCop }.freeze
- PARAMETER_RULE_CLASSES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ 'changed_parameters' => ChangedParameter, 'changed_enforced_styles' => ChangedEnforcedStyles }.freeze
Class Attribute Summary collapse
- .files ⇒ Object private
Instance Attribute Summary collapse
- #rules ⇒ Object readonly private
- #warnings ⇒ Object readonly private
Class Method Summary collapse
- .legacy_cop_names ⇒ Object private
Instance Method Summary collapse
-
#initialize(config) ⇒ ConfigObsoletion
constructor
private
A new instance of ConfigObsoletion.
- #reject_obsolete! ⇒ Object private
Constructor Details
#initialize(config) ⇒ ConfigObsoletion
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 ConfigObsoletion.
35 36 37 38 39 |
# File 'lib/rubocop/config_obsoletion.rb', line 35 def initialize(config) @config = config @rules = load_rules @warnings = [] end |
Class Attribute Details
.files ⇒ 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.
24 25 26 |
# File 'lib/rubocop/config_obsoletion.rb', line 24 def files @files end |
Instance Attribute Details
#rules ⇒ 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.
21 22 23 |
# File 'lib/rubocop/config_obsoletion.rb', line 21 def rules @rules end |
#warnings ⇒ 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.
21 22 23 |
# File 'lib/rubocop/config_obsoletion.rb', line 21 def warnings @warnings end |
Class Method Details
.legacy_cop_names ⇒ 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.
26 27 28 29 |
# File 'lib/rubocop/config_obsoletion.rb', line 26 def legacy_cop_names # Used by DepartmentName#qualified_legacy_cop_name new(Config.new).rules.select(&:cop_rule?).map(&:old_name) end |
Instance Method Details
#reject_obsolete! ⇒ 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.
41 42 43 44 45 46 |
# File 'lib/rubocop/config_obsoletion.rb', line 41 def reject_obsolete! = obsoletions.flatten.compact return if .empty? raise ValidationError, .join("\n") end |