Class: RuboCop::Cop::Chef::ChefDeprecations::UserDeprecatedSupportsProperty
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefDeprecations::UserDeprecatedSupportsProperty
- Includes:
- RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/deprecation/user_supports_property.rb
Overview
The supports property was removed in Chef Infra Client 13 in favor of individual ‘manage_home’ and ‘non_unique’ properties.
Constant Summary collapse
- MSG =
"The supports property was removed in Chef Infra Client 13 in favor of individual 'manage_home' and 'non_unique' properties.".freeze
Instance Method Summary collapse
Methods included from RuboCop::Chef::CookbookHelpers
#match_property_in_resource?, #match_resource_type?, #method_arg_ast_to_string, #resource_block_name_if_string
Instance Method Details
#autocorrect(node) ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rubocop/cop/chef/deprecation/user_supports_property.rb', line 50 def autocorrect(node) lambda do |corrector| new_text = [] node.arguments.first.each_pair do |k, v| new_text << "#{k.source} #{v.source}" end corrector.replace(node.loc.expression, new_text.join("\n ")) end end |
#on_block(node) ⇒ Object
44 45 46 47 48 |
# File 'lib/rubocop/cop/chef/deprecation/user_supports_property.rb', line 44 def on_block(node) match_property_in_resource?(:user, 'supports', node) do |property| add_offense(property, location: :expression, message: MSG, severity: :refactor) end end |