Class: RuboCop::Cop::Chef::ChefModernize::WindowsVersionHelper

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/chef/modernize/windows_version_helper.rb

Overview

Use node data instead of the Windows::VersionHelper helper from the Windows cookbook.

Examples:


# bad
Windows::VersionHelper.nt_version

# good
node['platform_version].to_i

Constant Summary collapse

MSG =
"Use node['platform_version'] data instead of the Windows::VersionHelper helper from the Windows cookbook.".freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



38
39
40
41
42
# File 'lib/rubocop/cop/chef/modernize/windows_version_helper.rb', line 38

def on_send(node)
  windows_helper?(node) do
    add_offense(node, location: :expression, message: MSG, severity: :refactor)
  end
end