puppetlabs / puppetlabs/puppet-strings

Broken function documentation when using newer rubies and function contains any code before documentation

Open
#296 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
90
Forks
90
PR merge metrics
No merged PRs in 30d

Description

I've noticed that when generating reference documentation for stdlib, the version of ruby used changes the output.
Specifically, the documentation for to_yaml and to_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' and require '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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/puppet/functions/to_yaml.rb and lib/puppet/functions/to_json.rb, then reproduce reference generation with Ruby 2.5 and 2.7 using Puppet Strings 2.9.0. Trace how documentation comments are extracted when require statements precede them; done means both functions produce documentation consistently across the reported Ruby versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
documentation, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.