puppetlabs / puppetlabs/puppet-strings

puppet-strings insists on redundant return value for puppet functions

Open
#297 2 comments 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

Describe the Bug

When generating the documentation of a Puppet function, puppet-strings wants to see a @return tag in the comments, while the code already include the returned type.

Expected Behavior

puppet-strings should not want a @return tag.

Steps to Reproduce

Generate the documentation of a function (example taken from stdlib):

# @summary function to cast ensure parameter to resource specific value
function stdlib::ensure(
  Variant[Boolean, Enum['present', 'absent']] $ensure,
  Enum['directory', 'link', 'mounted', 'service', 'file', 'package'] $resource,
) >> String {
  # [...]
}

Note the >> String that tells what the function returns.

Environment

  • Version : 2.9.0
  • Platform : Any

Additional Context

Suggested by @ekohl in https://github.com/puppetlabs/puppetlabs-stdlib/pull/1239#discussion_r861254739

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 by reproducing documentation generation for the stdlib::ensure example and trace the validation that requires a @return tag. Confirm how Puppet's declared return type is parsed, then add coverage showing that a typed function needs no redundant tag; done when generation succeeds without @return and existing tests remain passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
documentation
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.