Commit Graph

202 Commits

Author SHA1 Message Date
Henrik Lindberg d6c8bc507c Merge pull request #50 from iankronquist/choke-yard-warnings
(PDOC-38) Prevent warnings from being issued twice
2015-09-07 05:28:34 -07:00
Henrik Lindberg eeeb89f565 Merge pull request #53 from iankronquist/fix-defined-function-crash
(PDOC-45) Puppet 4x functions handle unusual names
2015-09-07 05:25:16 -07:00
Ian Kronquist 11e016e81e (PDOC-38) Prevent warnings from being issued twice
Since we threw away all of Yard's warnings we are no longer checking that the
parameter names match for Ruby methods. Thus we need to override Yard's
method_details template with our own to trigger our warning function. However,
there's a catch. If this ruby method is in a Puppet 4x function, we don't want
our warning function to trigger because the user has already been warned. Look
in the registry to see if there is already a Puppet 4x function with the same
name registered.

Also, print errors to stderr instead of using log.warn.
2015-09-04 14:45:08 -07:00
Ian Kronquist c4a1a10c67 (PDOC-45) Test Puppet 4x functions don't throw
Parsing puppet 4x functions with symbols for their names like :'defined' should
not raise ParseErrorWithIssue, or anything for that matter.
2015-09-01 15:42:37 -07:00
Ian Kronquist 84a215d599 (PDOC-45) Puppet 4x functions handle unusual names
`lib/puppet/functions/defined.rb` has some unusual syntax:

	Puppet::Functions.create_function(:'defined', ....

It runs, so apparently this is legal.
2015-09-01 15:31:13 -07:00
Ian Kronquist 346832a5f8 Merge pull request #51 from roidelapluie/master
(MAINT) Add a space between a parameter name type and its description
2015-08-31 09:48:44 -07:00
Julien Pivotto 005a3112c9 (MAINT) Add a space between a parameter name type and its description
Before this commit:

    packages (Array[String])- A list of packages to be installed

With this commit:

    packages (Array[String]) - A list of packages to be installed
2015-08-31 12:27:28 +02:00
Ian Kronquist f052675088 (PDOC-38) Add parameter mismatch warnings for 4.x 2015-08-21 10:36:31 -07:00
Ian Kronquist fe2420bc01 (PDOC-38) Monkey patch Yard's logger
Redirect Yard command line warnings to a log file called `.yardwarns`.
Yard warnings may be irrelevant, spurious, or may not conform with our
styling and UX design. They are also printed on stdout by default.
2015-08-21 10:36:31 -07:00
Hailee Kenney 2a11a85787 Merge pull request #49 from iankronquist/duplicate-warnings
(PDOC-21) Duplicate warnings
2015-08-19 10:58:01 -07:00
Ian Kronquist f5c4c4c861 (PDOC-21) Test for duplicate hostclass warnings
* Add testing file based off shaigy's tests.
* Refactor using_module into a helper class.
* Expect that the warnings printed to stdout are *exactly* what I want to see
  and nothing else.
2015-08-19 10:50:03 -07:00
Ian Kronquist bd8d159016 (PDOC-21) Fix duplicate warnings for hostclasses
Host classes inherit behavior from defined types. I didn't realize this when I
was first implementing this functionality.
2015-08-19 10:47:32 -07:00
Hailee Kenney aebdda4acd Merge pull request #48 from iankronquist/double-hostclass-params/PDOC-21
(PDOC-21) Only create HostClass parameters once
2015-08-12 10:31:46 -07:00
Ian Kronquist badd019364 (PDOC-21) Only create HostClass parameters once
You can pass a block to the constructor of the hostclass. For some reason Yard
is yielding the block twice. Our code is not yielding the block because we only
use yield in one place which is unrelated. I don't think this is intended
behavior on yard's part, it certainly seems odd, but we can dodge the question
and not have to wait for an upstream patch by extracting the logic from the
block and running it after the object has been initialized.
2015-08-12 10:18:31 -07:00
Hailee Kenney 05f489fcee Merge pull request #45 from iankronquist/extraneous-true
(maint) Don't print extraneous "true".
2015-08-04 16:09:17 -07:00
Ian Kronquist f7165d6634 (maint) Don't print extraneous "true".
Suppress it by printing an empty string instead.
2015-08-04 15:34:13 -07:00
Hailee Kenney c33f911f09 Merge pull request #44 from iankronquist/defined-types-mismatched-types
(PDOC-21) Check mismatched types in defined types
2015-08-03 15:49:29 -07:00
Ian Kronquist c7af917c35 (PDOC-21) Check mismatched types in defined types
Check that the types for defined types match those specified in the
documentation. This is already being done for classes.
2015-08-03 14:12:32 -07:00
Hailee Kenney b1b27a33d3 Merge pull request #41 from iankronquist/nested-classes/pdoc-35
Nested classes/pdoc 35
2015-07-30 14:07:10 -07:00
Kylo Ginsberg a9781d65bd Merge pull request #43 from iankronquist/yard-install-instructions/pdoc-33
(PDOC-33) Inform reader how to install yard gem
2015-07-29 13:17:56 -07:00
Ian Kronquist 088b1b3521 (PDOC-33) Inform reader how to install yard gem
The easiest cross platform way to install the yard gem is actually with puppet
itself. We still need to cover the puppet 3.x vs 4.x cases though.
2015-07-29 12:43:33 -07:00
Ian Kronquist 457ec86a2b (PDOC-35) Test strings works with nested classes 2015-07-28 14:56:14 -07:00
Hailee Kenney e9167b11e6 Merge pull request #42 from iankronquist/forgot-defined-types
Forgot defined types
2015-07-28 13:35:00 -07:00
Ian Kronquist 9083023b33 (maint) Fix typo in emitted html 2015-07-28 13:27:28 -07:00
Ian Kronquist 2d2c03bc33 (PDOC-19) Parse type information for defined types
I forgot to include the code which extracts the type information for the code
object in the defined types handler. Without this we do not extract type
information from defined types so warnings cannot be emitted and types in the
documentation are listed as Unknown.
2015-07-28 13:27:28 -07:00
Hailee Kenney abf3b786c5 Merge pull request #39 from iankronquist/readme-update/PDOC-33
(PDOC-33) Inform reader how to install yard gem
2015-07-22 10:11:17 -07:00
Ian Kronquist 4dc6bc429a (PDOC-35) Dispatch handlers in correct order
Subclasses have their superclass as part of their namespace and objects in the
subclass's namespace must be registered first.
Reverse the list of parsed objects so
that the classes will be handled and registered in the correct order.
2015-07-21 15:15:30 -07:00
Hailee Kenney 0d8c4e75fe Merge pull request #37 from iankronquist/markdown-madness/PDOC-30
(PDOC-30) Fix Markdown parsing lists parsing
2015-07-20 16:56:51 -07:00
Hailee Kenney 36a5e12edc (maint) Require puppet version >= 3.7 for typing
Prior to this commit, the metadata for strings required a puppet
version of 3.6.0 or greater. However, now that we are deriving
parameter type information, we need 3.7.0 or greater because parameter
typing was not included in previous versions of the parser.

Update the metadata to reflect this change in version requirement.
2015-07-20 16:49:33 -07:00
Ian Kronquist 5a63c9832e (PDOC-33) Inform reader how to install yard gem
Also includes a variety of other README updates and modernizations.
2015-07-17 10:59:21 -07:00
Hailee Kenney bd319f3c82 Merge pull request #38 from iankronquist/better-type-error
(maint) Remove unused code path
2015-07-17 10:59:06 -07:00
Ian Kronquist 641cba8c2d (maint) Improve message when type error is raised
Addresses @hlindberg's comment after PR #35 was closed.
Use the error message from the exception which is actually exactly what I
wanted to say anyway.
2015-07-16 16:20:49 -07:00
Ian Kronquist 6137e94a25 (PDOC-30) Fix Markdown parsing lists parsing
The transformer comment matching regex matched all whitespace after a comment.
Lines which were effectively "blank" and just had a comment would be erased.
Markdown lists need to end with a blank line. This messed up markdown
formatting.

The culprit is the regex /^\s*#\s/ which matches all of the comment ' #\n',
however we want to leave the newline alone for markdown to parse.
We replace the regex with /^\s*#[ \t]/ which will only match tabs or spaces
after the hash and leave our beloved newline alone.
2015-07-16 11:50:52 -07:00
Hailee Kenney 16186ef911 Merge pull request #36 from puppetlabs/actually/PDOC-19
Actually/pdoc 19
2015-07-15 16:47:04 -07:00
Ian Kronquist 37d5d08271 (PDOC-19) Fix merge mistakes
* An empty file got added back in the chaos. Delete it again.
* One of the comments was out of date.
2015-07-15 16:35:26 -07:00
Ian Kronquist c4b1d0d10d (PDOC-19) Output type info in generated html 2015-07-15 16:34:08 -07:00
Ian Kronquist c027084f1a (PDOC-21) Typecheck documented parameters
The documented parameter types should be compared with the actual types when
possible.
2015-07-15 16:34:08 -07:00
Hailee Kenney 2ceead0822 Merge pull request #35 from iankronquist/type-checking/PDOC-19
Type checking/pdoc 21
2015-07-15 16:29:18 -07:00
Ian Kronquist 4653a5f9f0 (PDOC-21) Typecheck documented parameters
The documented parameter types should be compared with the actual types when
possible.
2015-07-15 11:58:36 -07:00
Henrik Lindberg 2e3821c2af Merge pull request #33 from iankronquist/dispatch-params/PDOC-37
Dispatch params/pdoc 37
2015-07-13 15:52:01 -07:00
Ian Kronquist 081bbfe790 (PDOC-37) Parse 4x function ast type and params
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.
2015-07-13 15:42:26 -07:00
Ian Kronquist 8b3cdd3a51 (PDOC-37) Add additional tests for parameter names
* Test positive cases (warnings AREN'T printed when they shouldn't be)
* Test puppet functions which use dispatches
2015-07-08 16:09:36 -07:00
Hailee Kenney c8fbe3c20f Merge pull request #31 from iankronquist/warn-when-not-matching/PDOC-21
(PDOC-37) Warn when documented name does not match declared name
2015-07-06 20:06:08 -07:00
Ian Kronquist 168c1c4b53 (PDOC-37) Override Yard logger on a per test basis
Override Yard logger on a per test basis, not globally.
Replace one hack with another slightly less disgusting one.
2015-07-06 16:40:30 -07:00
Hailee Kenney 3edf7347df (maint) Remove rspec-html-matchers from acceptance
Prior to this commit, the acceptance tests were using the
rspec-html-matchers gem which we had removed because it does not
work with rspec 3.

In order to make the acceptance tests compatible with this change,
use string matching to check the HTML output instead and remove
the dependency on that gem.
2015-07-06 11:55:59 -07:00
Ian Kronquist d37e071ab7 (PDOC-37) Test errors are output properly
Also comment out a statement which we frequently use for debugging which
snuck in by accident.
2015-07-06 10:18:48 -07:00
Ian Kronquist 463d4e0a1f (PDOC-37) Attach params to Puppet 4.x code object
Traverse the ruby AST to get method arguments and attach them to the code
object.
* Fixes spurious warnings issued by yard.
* Obviates the need for ugly regex code in the templates to retrieve
  parameters from the source code.
2015-07-06 10:18:48 -07:00
Ian Kronquist 49171c92b9 (PDOC-37) Warn if parameter names don't match docs
Print the name of the parameter, the file, and the line number to stderr if the
parameter name does not match the name specified in the docs.
In order for this to be useful we need to present the user with the file name
and line number of the relevant parameters. This information needs to be
extracted from the code object and passed to the extract_param_details method.
2015-07-06 10:18:48 -07:00
Ian Kronquist 584b87e6c7 Merge pull request #32 from hkenney/maint/master/stop_using_html_matchers
(maint) Remove html-matchers dependency
2015-07-06 10:17:04 -07:00
Hailee Kenney 917d9b6536 (maint) Remove html-matchers dependency
Prior to this commit, some of the unit tests for strings relied on
the rspec-html-matchers gem, which does not seem to get along with
rspec 3. This meant that we had to tie our tests to rspec 2 which
has become too inconvenient.

In order to remove the gem, use simple string matching instead.
Update the Gemfile so that it no longer requires the matchers and
no longer has rspec tied to 2.7.
2015-07-02 15:12:49 -07:00