Class: RuboCop::Cop::Chef::Correctness::InvalidPlatformHelper
- Includes:
- RuboCop::Chef::PlatformHelpers
- Defined in:
- lib/rubocop/cop/chef/correctness/invalid_platform_helper.rb
Overview
Pass valid platforms to the ‘platform?` helper. See [Infra Language: Platform](docs.chef.io/infra_language/checking_platforms/#platform-values) for a list of many common platform values.
Constant Summary collapse
- MSG =
'Pass valid platforms to the platform? helper.'
- RESTRICT_ON_SEND =
[:platform?].freeze
Constants included from RuboCop::Chef::PlatformHelpers
RuboCop::Chef::PlatformHelpers::INVALID_PLATFORMS, RuboCop::Chef::PlatformHelpers::INVALID_PLATFORM_FAMILIES
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_send(node) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/rubocop/cop/chef/correctness/invalid_platform_helper.rb', line 46 def on_send(node) platform_helper?(node) do |plat| plat.to_a.each do |p| add_offense(p, severity: :refactor) if INVALID_PLATFORMS.key?(p.value) end end end |