Skip to content

Commit

Permalink
Merge pull request #10 from domcleal/8-hash-keys
Browse files Browse the repository at this point in the history
Ignore function names followed by `=>` symbol
  • Loading branch information
rnelson0 committed Jun 23, 2016
2 parents 2bcc7e8 + c9bcaf1 commit f8ee123
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet-lint/plugins/check_absolute_classname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f8ee123

Please sign in to comment.