diff --git a/lib/puppet-lint/data.rb b/lib/puppet-lint/data.rb index f2dd669b..8937ef9a 100644 --- a/lib/puppet-lint/data.rb +++ b/lib/puppet-lint/data.rb @@ -146,9 +146,10 @@ def resource_indexes # # Returns a Token object. def find_resource_type_token(index) - tokens[tokens[0..index].rindex { |token| - token.type == :LBRACE && token.prev_code_token.type != :QMARK - }].prev_code_token + lbrace_idx = tokens[0..index].rindex { |token| + token.type == :LBRACE && token.prev_code_token.type != :QMARK + } + tokens[lbrace_idx].prev_code_token end # Internal: Find all the Token objects representing the parameter names in