Class: RuboCop::Cop::Chef::Modernize::EmptyResourceInitializeMethod

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
RangeHelp
Defined in:
lib/rubocop/cop/chef/modernize/empty_resource_initialize.rb

Overview

There is no need for an empty initialize method in a resource

Examples:


### incorrect
def initialize(*args)
  super
end

Constant Summary collapse

MSG =
'There is no need for an empty initialize method in a resource'

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_def(node) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/rubocop/cop/chef/modernize/empty_resource_initialize.rb', line 41

def on_def(node)
  empty_initialize?(node) do
    add_offense(node, severity: :refactor) do |corrector|
      corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left))
    end
  end
end