Skip to content

Commit

Permalink
Fix for type matching misdetection with !~
Browse files Browse the repository at this point in the history
The fix in 0753217 was incomplete
as it only handled the case where a positive match was used (=~).
  • Loading branch information
seanmil committed Nov 20, 2018
1 parent 40f31cb commit b079eae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet-lint/plugins/check_trailing_comma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class { '::apache':
if $var =~ Sensitive {
$foo = $var.unwrap
}
if $var !~ Mymodule::MyType {
fail("encountered error ${err}")
}
EOS
}

Expand Down

0 comments on commit b079eae

Please sign in to comment.