diff --git a/lib/puppet-lint/plugins/check_trailing_comma.rb b/lib/puppet-lint/plugins/check_trailing_comma.rb index d1d8936..1ceb341 100644 --- a/lib/puppet-lint/plugins/check_trailing_comma.rb +++ b/lib/puppet-lint/plugins/check_trailing_comma.rb @@ -62,7 +62,7 @@ def defaults_indexes # Ensure that we aren't matching a function return type: token.prev_code_token.type != :RSHIFT && \ # Or a conditional matching a type: - token.prev_code_token.type != :MATCH + ! [:MATCH, :NOMATCH].include?(token.prev_code_token.type) real_idx = 0 tokens[token_idx+1..-1].each_with_index do |cur_token, cur_token_idx| diff --git a/spec/puppet-lint/plugins/check_trailing_comma/check_trailing_comma_spec.rb b/spec/puppet-lint/plugins/check_trailing_comma/check_trailing_comma_spec.rb index e0b4492..7dd02b8 100644 --- a/spec/puppet-lint/plugins/check_trailing_comma/check_trailing_comma_spec.rb +++ b/spec/puppet-lint/plugins/check_trailing_comma/check_trailing_comma_spec.rb @@ -66,6 +66,10 @@ class { '::apache': if $var =~ Sensitive { $foo = $var.unwrap } + + if $var !~ Mymodule::MyType { + fail("encountered error ${err}") + } EOS }