Class: RuboCop::Cop::Chef::RedundantCode::AttributeMetadata

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
RangeHelp, RuboCop::Chef::AutocorrectHelpers
Defined in:
lib/rubocop/cop/chef/redundant/attribute_metadata.rb

Overview

The attribute metadata.rb method is not used and is unnecessary in cookbooks.

Examples:


### incorrect in metadata.rb:

 attribute 'zookeeper_bridge/server',
           display_name: 'zookeeper server',
           description: 'Zookeeper server address.',
           type: 'string',
           required: 'optional',
           default: '"127.0.0.1:2181"'

Constant Summary collapse

MSG =
'The attribute metadata.rb method is not used and is unnecessary in cookbooks.'
RESTRICT_ON_SEND =
[:attribute].freeze

Instance Method Summary collapse

Methods included from RuboCop::Chef::AutocorrectHelpers

#expression_including_heredocs

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



43
44
45
46
47
# File 'lib/rubocop/cop/chef/redundant/attribute_metadata.rb', line 43

def on_send(node)
  add_offense(node, severity: :refactor) do |corrector|
    corrector.remove(range_with_surrounding_space(range: expression_including_heredocs(node), side: :left))
  end
end