Class: RuboCop::Cop::Chef::Deprecations::ResourceInheritsFromCompatResource
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Chef::Deprecations::ResourceInheritsFromCompatResource
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb
Overview
Resources written in the class based HWRP style should inherit from the ‘Chef::Resource’ class and not the ‘ChefCompat::Resource’ class from the deprecated compat_resource cookbook.
Constant Summary collapse
- MSG =
"HWRP style resource should inherit from the 'Chef::Resource' class and not the 'ChefCompat::Resource' class from the deprecated compat_resource cookbook."
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_class(node) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/rubocop/cop/chef/deprecation/inherits_compat_resource.rb', line 48 def on_class(node) inherits_from_compat_resource?(node) do add_offense(node, severity: :warning) do |corrector| corrector.replace(node, node.source.gsub('ChefCompat', 'Chef')) end end end |