A linting tool that helps you to write better Chef Infra cookbooks and InSpec profiles by detecting and automatically correcting style, syntax, and logic mistakes in your code.
[ ] Chef/Deprecations - A cop that alerts on a deprecation in the Chef Infra Client
[ ] Chef/Correctness - A cop that alerts when incorrect coding behavior is being used
[ ] Chef/Sharing - A cop that alerts to missing functionality necessary for sharing cookbooks with others
[ ] Chef/Style - A cop that alerts to a style best practice
[ ] Chef/Modernize - A cop that alerts when a cookbook can be simplified or modernized with new functionality
[ ] Chef/Effortless - A cop that alerts on code that must be resolved to move to the Effortless pattern
[x] Chef/RedundantCode - A cop that detects redundant code regardless of Chef Infra release
[ ] InSpec/Deprecations - A cop that alerts on a deprecation in the Chef InSpec
Describe the new cop:
We can avoid ternary operators that check if a value is an array before trying to make it an Array.
What it would trigger on:
property :template_helpers, [String, Array],
description: 'Additional helper modules to include in the default site and config template',
coerce: proc { |p| p.is_a?(Array) ? p : [p] }
What it would autocorrect to if applicable
property :template_helpers, [String, Array],
description: 'Additional helper modules to include in the default site and config template',
coerce: proc { |p| Array(p) }
What category of cop is this?:
Please try to select as few as possible.
Describe the new cop:
We can avoid ternary operators that check if a value is an array before trying to make it an Array.
What it would trigger on:
What it would autocorrect to if applicable