cookstyle icon indicating copy to clipboard operation
cookstyle copied to clipboard

Detect 1 line here docs in execute / script resources

Open tas50 opened this issue 5 years ago • 0 comments

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
  • [x] 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:

1 line here docs turn a single "command" property into 3 lines for no reason. We should convert these back into strings.

What it would trigger on:

bash 'chown' do
  user 'root'
  cwd '/'
  code <<-EOH
  chown bob:boberson -R /app
  EOH
end

What it would autocorrect to if applicable

bash 'chown' do
  user 'root'
  cwd '/'
  code 'chown bob:boberson -R /app'
end

tas50 avatar Sep 19 '19 04:09 tas50