Class: RuboCop::Cop::Chef::Sharing::EmptyMetadataField

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/chef/sharing/empty_metadata_field.rb

Overview

metadata.rb should not include fields with an empty string. Either don’t include the field or add a value.

Examples:


### incorrect
license ''

### correct
license 'Apache-2.0'

Constant Summary collapse

MSG =
'Cookbook metadata.rb contains a field with an empty string.'

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



37
38
39
40
41
42
# File 'lib/rubocop/cop/chef/sharing/empty_metadata_field.rb', line 37

def on_send(node)
  field?(node) do |str|
    return unless str.value.empty?
    add_offense(str, severity: :refactor)
  end
end