class RuboCop::Cop::Chef::RedundantCode::UnnecessaryDesiredState
There is no need to set a property/attribute to desired_state: true as all properties/attributes have a desired_state of true by default.
@example
#### incorrect property :foo, String, desired_state: true attribute :foo, String, desired_state: true #### correct property :foo, String attribute :foo, String
Constants
- MSG
- RESTRICT_ON_SEND
Public Instance Methods
on_send(node)
click to toggle source
# File lib/rubocop/cop/chef/redundant/unnecessary_desired_state.rb, line 45 def on_send(node) property?(node) do |hash_vals| hash_vals.each_pair do |k, v| next unless k == s(:sym, :desired_state) && v == s(:true) # cookstyle: disable Lint/BooleanSymbol add_offense(v.parent, severity: :refactor) do |corrector| range = range_with_surrounding_comma(range_with_surrounding_space(range: v.parent.loc.expression, side: :left), :left) corrector.remove(range) end end end end