Class: RuboCop::ConfigObsoletion::ChangedEnforcedStyles Private

Inherits:
ParameterRule show all
Defined in:
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.

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>s: %<value>s` (for `%<cop>s`) found in %<path>s'

Instance Attribute Summary

Attributes inherited from ParameterRule

#cop, #metadata, #parameter

Instance Method Summary collapse

Methods inherited from ParameterRule

#initialize, #parameter_rule?, #warning?

Methods inherited from Rule

#cop_rule?, #initialize, #parameter_rule?

Constructor Details

This class inherits a constructor from RuboCop::ConfigObsoletion::ParameterRule

Instance Method Details

#messageObject

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.


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rubocop/config_obsoletion/changed_enforced_styles.rb', line 14

def message
  base = format(BASE_MESSAGE,
                parameter: parameter, value: value, cop: cop, path: smart_loaded_path)

  if alternative
    "#{base}\n`#{parameter}: #{value}` has been renamed to " \
      "`#{parameter}: #{alternative.chomp}`."
  else
    "#{base}\n#{reason.chomp}"
  end
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.

Returns:

  • (Boolean)

10
11
12
# File 'lib/rubocop/config_obsoletion/changed_enforced_styles.rb', line 10

def violated?
  super && config[cop][parameter] == value
end