Skip to content

Commit

Permalink
Fix function call name token type in function_indexes method
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hsnodgrass authored and jordanbreen28 committed Jul 5, 2024
1 parent 66ed4a2 commit 0a278ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet-lint/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 389 in lib/puppet-lint/data.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-lint/data.rb#L389

Added line #L389 was not covered by tests
next unless token_idx.zero? ||
(token_idx == 1 && tokens[0].type == :WHITESPACE) ||
[:NEWLINE, :INDENT].include?(token.prev_token.type) ||
Expand Down

0 comments on commit 0a278ac

Please sign in to comment.