class RuboCop::Cop::Chef::Style::SimplifyPlatformMajorVersionCheck

When checking the major version number of a platform you can take the node attribute and transform it to an integer to strip it down to just the major version number. This simple way of determining the major version number of a platform should be used instead of splitting the platform into multiple fields with ‘.’ as the delimiter.

@example

### incorrect
node['platform_version'].split('.').first
node['platform_version'].split('.')[0]
node['platform_version'].split('.').first.to_i
node['platform_version'].split('.')[0].to_i

### correct

# check to see if we're on RHEL 7 on a RHEL 7.6 node where node['platform_version] is 7.6.1810
if node['platform_version'].to_i == 7
  # some code
end