Skip to main content

InvalidPlatformValueForPlatformHelper

All Cookstyle Cops


The department is: Chef/Correctness

The full name of the cop is: Chef/Correctness/InvalidPlatformValueForPlatformHelper


Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledNoAll Versions

Pass valid platforms to the value_for_platform helper.

Examples

incorrect

value_for_platform(
  %w(rhel mac_os_x_server) => { 'default' => 'foo' },
  %w(sles) => { 'default' => 'bar' }
)```

#### correct

```ruby
value_for_platform(
  %w(redhat mac_os_x) => { 'default' => 'foo' },
  %w(opensuseleap) => { 'default' => 'bar' }
)

Configurable attributes

NameDefault valueConfigurable values
Version Added5.15.0String
Exclude
  • **/metadata.rb
  • **/Berksfile
Array

Was this page helpful?