Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect an array with a single item used to create a resource #795

Open
1 of 7 tasks
tas50 opened this issue Nov 6, 2020 · 0 comments
Open
1 of 7 tasks

Detect an array with a single item used to create a resource #795

tas50 opened this issue Nov 6, 2020 · 0 comments
Labels
New Cop Proposal A proposal for a new Cookstyle cop Status: Untriaged An issue that has yet to be triaged.

Comments

@tas50
Copy link
Contributor

tas50 commented Nov 6, 2020

What category of cop is this?:

Please try to select as few as possible.

  • 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
  • Chef/RedundantCode - A cop that detects redundant code regardless of Chef Infra release

Describe the new cop:

Iterating over an array with a single object to create a resource is way more complex than we need to be.

What it would trigger on:

%w(bind9).each do |pkg|
  package pkg do
    action :install
  end
end

What it would autocorrect to if applicable

  package bind9 do
    action :install
  end
end
@tas50 tas50 added Status: Untriaged An issue that has yet to be triaged. New Cop Proposal A proposal for a new Cookstyle cop labels Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Cop Proposal A proposal for a new Cookstyle cop Status: Untriaged An issue that has yet to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant