class RuboCop::Cop::Chef::Deprecations::MacosUserdefaultsGlobalProperty

The `global` property in the macos_userdefaults resource was deprecated in Chef Infra Client 16.3. This property was never properly implemented and caused failures under many conditions. Omitting the `domain` property will now set global defaults.

@example

#### incorrect
macos_userdefaults 'set a value' do
  global true
  key 'key'
  value 'value'
end

#### correct
macos_userdefaults 'set a value' do
  key 'key'
  value 'value'
end

Constants

MSG

Public Instance Methods

on_block(node) click to toggle source
# File lib/rubocop/cop/chef/deprecation/macos_userdefaults_global_property.rb, line 49
def on_block(node)
  match_property_in_resource?(:macos_userdefaults, 'global', node) do |global|
    add_offense(global.loc.expression, message: MSG, severity: :warning) do |corrector|
      corrector.remove(range_with_surrounding_space(range: global.loc.expression, side: :left))
    end
  end
end