Skip to content

Commit

Permalink
Merge pull request #7 from domcleal/6-ignore-resource-metaparams
Browse files Browse the repository at this point in the history
Ignore 'require' function name appearing in resource parameters
  • Loading branch information
bastelfreak authored Jun 23, 2016
2 parents 69cfe96 + c4355ef commit dcbcf1f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/puppet-lint/plugins/check_absolute_classname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
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
in_function = 0
while s.type != :NEWLINE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ class { 'foobar': }
expect(problems).to contain_warning(msg).on_line(7).in_column(17)
end
end

context 'when the require metadata parameter is used' do
let(:code) do
<<-EOS
file { '/path':
ensure => present,
require => Shellvar['http_proxy'],
}
EOS
end

it 'should detect no problems' do
expect(problems).to have(0).problems
end
end
end

context 'with fix enabled' do
Expand Down

0 comments on commit dcbcf1f

Please sign in to comment.