Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch params/pdoc 37 #33

Merged
merged 2 commits into from
Jul 13, 2015

Conversation

iankronquist
Copy link
Contributor

* Test positive cases (warnings AREN'T printed when they shouldn't be)
* Test puppet functions which use dispatches
return [] if param_name_ident == type_specifier
param_name = param_name_ident.source
#require 'pry'; binding.pry
#puts [param_name, param_signature].inspect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out debug lines ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should write a pre commit hook which greps for these. Thanks.

@HAIL9000
Copy link
Contributor

Except the debug statements I am 👍 on this. Really awesome work @iankronquist nice job.

@hlindberg Could you take a second look at this? As someone who's familiar with Puppet AST nodes and the parser.

end

# If the overload_signatures list is empty because we couldn't find any
# dispatch blocks, then there must be one function named the same as the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"must be one method" instead of "must be one function" (would make the comment more clear).

@hlindberg
Copy link
Contributor

I would like to see an example that uses parameterized types e.g. Integer[2,10]

@iankronquist iankronquist force-pushed the dispatch-params/PDOC-37 branch from 64dd545 to ee73970 Compare July 10, 2015 15:40
@iankronquist
Copy link
Contributor Author

@hlindberg

  1. I updated the comments. I like pedantic PRs, they're so easy to fix.
  2. I did not update the test header string to remove "should". All of the other tests in the file begin with "should" and it is my understanding that RSpec tests should begin this way. Perhaps I did not quite understand your issue with my phrasing, so I revised it so hopefully it is clearer.
  3. I added tests which use parameterized types for both the positive and negative cases.

@HAIL9000
Copy link
Contributor

@hlindberg Let me know when you're happy with this, I'll give it a final once over and merge

@hlindberg
Copy link
Contributor

+1
None of the examples seems to use a parameterized type (should work, but nice to have a test for that)
Need a ticket for handling 'captures rest' (varargs) functionality.

The previous iteration eagerly grabbed all parameters when any puppet function
was created. We did not retrieve type information and would grab parameters
from any helper functions!
* Parse the Ruby AST for dispatch blocks which specify type information. Parse
  the commands and arguments in those blocks.
* If there are no dispatch blocks, parse the AST for a ruby function with the
  same name as the puppet function being created.
@iankronquist iankronquist force-pushed the dispatch-params/PDOC-37 branch from 7a7f4b9 to 081bbfe Compare July 13, 2015 22:44
@iankronquist
Copy link
Contributor Author

@hlindberg sorry about that. I revised two of the tests (a positive and a negative case) to reflect that. The tests pass locally and on travis so I squashed and believe this is ready to merge.

hlindberg added a commit that referenced this pull request Jul 13, 2015
@hlindberg hlindberg merged commit 2e3821c into puppetlabs:master Jul 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants