Class: RuboCop::ConfigObsoletion::ChangedParameter Private
- Inherits:
-
ParameterRule
- Object
- Rule
- ParameterRule
- RuboCop::ConfigObsoletion::ChangedParameter
- Defined in:
- lib/rubocop/config_obsoletion/changed_parameter.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.
Encapsulation of a ConfigObsoletion rule for changing a parameter
Constant Summary collapse
- BASE_MESSAGE =
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.
'obsolete parameter `%<parameter>s` (for `%<cop>s`) found in %<path>s'
Instance Attribute Summary
Attributes inherited from ParameterRule
Instance Method Summary collapse
- #message ⇒ Object private
Methods inherited from ParameterRule
#initialize, #parameter_rule?, #violated?, #warning?
Methods inherited from Rule
#cop_rule?, #initialize, #parameter_rule?, #violated?
Constructor Details
This class inherits a constructor from RuboCop::ConfigObsoletion::ParameterRule
Instance Method Details
#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.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubocop/config_obsoletion/changed_parameter.rb', line 10 def base = format(BASE_MESSAGE, parameter: parameter, cop: cop, path: smart_loaded_path) if alternative "#{base}\n`#{parameter}` has been renamed to `#{alternative.chomp}`." elsif alternatives "#{base}\n`#{parameter}` has been renamed to #{to_sentence(alternatives.map do |item| "`#{item}`" end, connector: 'and/or')}." else "#{base}\n#{reason.chomp}" end end |