Class: RuboCop::Cop::Chef::ChefCorrectness::EmptyMetadataField

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/chef/correctness/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:


# bad
license ''

# good
license 'Apache-2.0'

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



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

def on_send(node)
  field?(node) do |str|
    add_offense(str, location: :expression, message: MSG, severity: :refactor) if str.value.empty?
  end
end