Class: RuboCop::Cop::Chef::ChefModernize::SetOrReturnInResources
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefModernize::SetOrReturnInResources
- Defined in:
- lib/rubocop/cop/chef/modernize/resource_set_or_return.rb
Overview
set_or_return within a method should not be used to define property in a resource. Instead use the property method which properly validates and defines properties in a way that works with reporting and documentation functionality in Chef Infra Client
Constant Summary collapse
- MSG =
'Do not use set_or_return within a method to define a property for a resource. Use the property method instead, which supports validation, reporting, and documentation functionality'.freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
43 44 45 46 47 |
# File 'lib/rubocop/cop/chef/modernize/resource_set_or_return.rb', line 43 def on_send(node) if node.method_name == :set_or_return add_offense(node, location: :expression, message: MSG, severity: :refactor) end end |