Skip to main content

MultiplePlatformChecks

All Cookstyle Cops


The department is: Chef/RedundantCode

The full name of the cop is: Chef/RedundantCode/MultiplePlatformChecks


Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

You can pass multiple values to the platform? and platform_family? helpers instead of calling the helpers multiple times.

Examples

incorrect

platform?('redhat') || platform?('ubuntu')
platform_family?('debian') || platform_family?('rhel')

correct

platform?('redhat', 'ubuntu')
platform_family?('debian', 'rhel')

Configurable attributes

NameDefault valueConfigurable values
Version Added6.10.0String
Exclude
  • **/metadata.rb
  • **/Berksfile
Array

Was this page helpful?