Class: RuboCop::Cop::Chef::Deprecations::LaunchdDeprecatedHashProperty
- Extended by:
- AutoCorrector, TargetChefVersion
- Includes:
- RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb
Overview
The launchd resource’s hash property was renamed to plist_hash in Chef Infra Client 13+ to avoid conflicts with Ruby’s hash class.
Constant Summary collapse
- MSG =
"The launchd resource's hash property was renamed to plist_hash in Chef Infra Client 13+ to avoid conflicts with Ruby's hash class."
Instance Method Summary collapse
Methods included from TargetChefVersion
minimum_target_chef_version, required_minimum_chef_version, support_target_chef_version?
Methods included from RuboCop::Chef::CookbookHelpers
#match_property_in_resource?, #match_resource_type?, #method_arg_ast_to_string, #resource_block_name_if_string
Methods inherited from Base
Instance Method Details
#on_block(node) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/rubocop/cop/chef/deprecation/launchd_deprecated_hash_property.rb', line 45 def on_block(node) match_property_in_resource?(:launchd, 'hash', node) do |offense| add_offense(offense.loc.expression, severity: :warning) do |corrector| corrector.replace(offense.loc.expression, offense.loc.expression.source.gsub(/^hash/, 'plist_hash')) end end end |