From 0a278ac0c033be5fee8daf564730681a779f2271 Mon Sep 17 00:00:00 2001 From: Heston Snodgrass Date: Wed, 17 Apr 2024 11:32:38 -0700 Subject: [PATCH] Fix function call name token type in function_indexes method Currently, the method `function_indexes` in `lib/puppet-lint/data.rb` doesn't work and only returns empty arrays. This is because, when iterating over the `token` array, tokens are skipped if their type does not equal `:NAME` but tokens that represent function call declarations have the type `:FUNCTION_NAME` and are skipped during iteration. --- lib/puppet-lint/data.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet-lint/data.rb b/lib/puppet-lint/data.rb index d4aa914a..f219cf5e 100644 --- a/lib/puppet-lint/data.rb +++ b/lib/puppet-lint/data.rb @@ -386,7 +386,7 @@ def function_indexes @function_indexes ||= begin functions = [] tokens.each_with_index do |token, token_idx| - next unless token.type == :NAME + next unless token.type == :FUNCTION_NAME next unless token_idx.zero? || (token_idx == 1 && tokens[0].type == :WHITESPACE) || [:NEWLINE, :INDENT].include?(token.prev_token.type) ||