Fix function call name token type in function_indexes method #198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently, the method
function_indexes
inlib/puppet-lint/data.rb
doesn't work and only returns empty arrays. This is because, when iterating over thetoken
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.Additional Context
Steps to reproduce:
lib/puppet-lint/plugins/<what ever your plugin name is>.rb
file, addrequire 'pry'; binding.pry
as the first line in the plugin's#check
method definition.:code
block that your plugin test will execute against has a Puppet function call in it (i.e.notice('This is the func')
)function_indexes
and see that it returns an empty array.Checklist
I didn't see any spec tests specific to this method so I didn't update any tests. Let me know if there are tests I should have updated for this.