diff --git a/lib/puppet-lint/plugins/check_absolute_classname.rb b/lib/puppet-lint/plugins/check_absolute_classname.rb index 7450294..913d106 100644 --- a/lib/puppet-lint/plugins/check_absolute_classname.rb +++ b/lib/puppet-lint/plugins/check_absolute_classname.rb @@ -2,8 +2,8 @@ def check tokens.each_with_index do |token, token_idx| if token.type == :NAME && ['include','contain','require'].include?(token.value) - next if resource_indexes.any? { |resource| resource[:tokens].include?(token) } s = token.next_code_token + next if s.type == :FARROW in_function = 0 while s.type != :NEWLINE n = s.next_code_token diff --git a/spec/puppet-lint/plugins/check_absolute_classname/relative_classname_inclusion_spec.rb b/spec/puppet-lint/plugins/check_absolute_classname/relative_classname_inclusion_spec.rb index c304c22..e7efd41 100644 --- a/spec/puppet-lint/plugins/check_absolute_classname/relative_classname_inclusion_spec.rb +++ b/spec/puppet-lint/plugins/check_absolute_classname/relative_classname_inclusion_spec.rb @@ -79,6 +79,23 @@ class { 'foobar': } expect(problems).to have(0).problems end end + + context 'when require is a hash key' do + let(:code) do + <<-EOS + $defaults = { + require => Exec['apt_update'], + } + $defaults = { + 'require' => Exec['apt_update'], + } + EOS + end + + it 'should detect no problems' do + expect(problems).to have(0).problems + end + end end context 'with fix enabled' do