Class: RuboCop::Cop::Chef::Correctness::InvalidCookbookName

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

Overview

Cookbook names should not contain invalid characters such as periods.

Examples:


### incorrect
name 'foo.bar'

### correct
name 'foo_bar'

Constant Summary collapse

RESTRICT_ON_SEND =
[:name].freeze
MSG =
'Cookbook names should not contain invalid characters such as periods.'

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



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

def on_send(node)
  has_name?(node) do |val|
    add_offense(node, severity: :refactor) if val.value.include?('.')
  end
end