Class: RuboCop::Cop::Chef::ChefModernize::OsxConfigProfileResource
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefModernize::OsxConfigProfileResource
- Defined in:
- lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb
Overview
The osx_config_profile resource was renamed to osx_profile. The new resource name should be used.
# bad
osx_config_profile 'Install screensaver profile' do
profile 'screensaver/com.company.screensaver.mobileconfig'
end
# good
osx_profile 'Install screensaver profile' do
profile 'screensaver/com.company.screensaver.mobileconfig'
end
Constant Summary collapse
- MSG =
'The osx_config_profile resource was renamed to osx_profile. The new resource name should be used.'.freeze
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
41 42 43 44 45 |
# File 'lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb', line 41 def autocorrect(node) lambda do |corrector| corrector.replace(node.loc.expression, node.source.gsub(/^osx_config_profile/, 'osx_profile')) end end |
#on_send(node) ⇒ Object
37 38 39 |
# File 'lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb', line 37 def on_send(node) add_offense(node, location: :expression, message: MSG, severity: :refactor) if node.method_name == :osx_config_profile end |