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 partial_search helper usage #183

Closed
1 of 7 tasks
tas50 opened this issue Aug 14, 2019 · 1 comment
Closed
1 of 7 tasks

Detect partial_search helper usage #183

tas50 opened this issue Aug 14, 2019 · 1 comment
Labels
New Cop Proposal A proposal for a new Cookstyle cop

Comments

@tas50
Copy link
Contributor

tas50 commented Aug 14, 2019

What category of cop is this?:

Please try to select as few as possible.

  • Deprecation - A cop that alerts to a deprecation in the Chef Infra Client
  • Correctness - A cop that alerts when incorrect coding behavior is being used
  • Sharing - A cop that alerts to missing functionality necessary for sharing cookboooks with others
  • Style - A cop that alerts to a style best practice
  • Simplification - A cop that alerts to ways code can be simplified through refactoring
  • Effortless - A cop that alerts on code that must be resolved to move to the Effortless pattern
  • Policyfiles - A cop that alerts on code that must be resolved to move to the Policyfiles pattern

Describe the new cop:

The partial search cookbook ships with a partial_search method. We deprecated the partial search cookbook and updated the built in search helper method to match the syntax of partial search. We should update any uses of the old partial_search method.

What it would trigger on:

partial_search(:node, 'role:web',
   :keys => { 'name' => [ 'name' ],
              'ip'   => [ 'ipaddress' ],
              'kernel_version' => [ 'kernel', 'version' ]
            }
).each do |result|
  puts result['name']
  puts result['ip']
  puts result['kernel_version']
end

What it would autocorrect to if applicable

search(:node, 'role:web',
   :filter_result => { 'name' => [ 'name' ],
              'ip'   => [ 'ipaddress' ],
              'kernel_version' => [ 'kernel', 'version' ]
            }
).each do |result|
  puts result['name']
  puts result['ip']
  puts result['kernel_version']
end
``
@tas50 tas50 added Status: Untriaged An issue that has yet to be triaged. New Cop Proposal A proposal for a new Cookstyle cop and removed Status: Untriaged An issue that has yet to be triaged. labels Aug 14, 2019
@tas50 tas50 changed the title Convert old usage of partial_search cookbook to new built in method Detect partial_search helper usage Nov 5, 2019
@tas50
Copy link
Contributor Author

tas50 commented Nov 5, 2019

Closed by #363

@tas50 tas50 closed this as completed Nov 5, 2019
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
Projects
None yet
Development

No branches or pull requests

1 participant