-
Notifications
You must be signed in to change notification settings - Fork 84
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
Broken function documentation when using newer rubies and function contains any code before documentation #296
Comments
I ran into the same issue with puppet's
Note the
But
Note the source https://github.com/puppetlabs/puppet/blob/8.8.0/lib/puppet/functions/yaml_data.rb#L3-L9 doesn't contain a blank line between the Adding one blank line resolves the issue:
|
Added a newline between the require statement and start of documentation to work around puppetlabs/puppet-strings#296 To verify, run: echo 'gem "puppet-strings"' >> Gemfile.local bundle update bundle exec puppet strings generate --format json --out /tmp/strings.json jq -r '.puppet_functions[] | select(.name == "yaml_data").docstring.text ' /tmp/strings.json | head
Added a newline between the require statement and start of documentation to work around puppetlabs/puppet-strings#296 To verify, run: echo 'gem "puppet-strings"' >> Gemfile.local bundle update bundle exec puppet strings generate --format json --out /tmp/strings.json jq -r '.puppet_functions[] | select(.name == "yaml_data").docstring.text ' /tmp/strings.json | head (cherry picked from commit dd4d8b8)
I've noticed that when generating reference documentation for stdlib, the version of ruby used changes the output.
Specifically, the documentation for
to_yaml
andto_json
doesn't get generated with Ruby 2.7 but does when using Ruby 2.5. (Puppet Strings 2.9.0 in both cases)No other functions in stdlib are affected. There appears to be an issue with having any code before the documentation comments. In these functions, this is a
require 'yaml'
andrequire 'json'
respectively. I could easily workaround the issue by moving this code into the function dispatches, but the change of behaviour between Ruby versions makes me think it's worth raising this as a bug here.The text was updated successfully, but these errors were encountered: