Skip to content

docs: add missing @return tags to every method - #66

Open
tas50 wants to merge 1 commit into
mainfrom
docs/yard-tags
Open

docs: add missing @return tags to every method#66
tas50 wants to merge 1 commit into
mainfrom
docs/yard-tags

Conversation

@tas50

@tas50 tas50 commented Aug 30, 2026

Copy link
Copy Markdown
Member

yard stats already reported 100% documented, but that only counts whether a
docstring exists. Measured over the .yardopts scope (which includes
--private --protected), 19 of 61 methods and attributes documented what they
took and what they did, but never what they handed back.

Before:

methods=61 missing_@param=0 missing_@return=19

After:

methods=61 missing_@param=0 missing_@return=0

@param coverage was already complete, and yard reports no warnings before
or after.

Private attr_readers

Most of the gap was private readers declared several to a line, such as
attr_reader :config, :client, :port, :logger. A single docstring above one of
those statements gives every reader the same @return, which would be wrong
for three of the four. YARD's attribute directives let each reader carry its
own type, but only when they follow the attr_reader statement -- attaching
them directly above it documents only the first name. They are therefore
grouped at the end of each class, with a comment saying why.

One correction

ServerOptions::SUFFIX_LENGTH was documented as "Random suffix appended to
generated names, plus its separator." It does not cover the separator:
generate_name budgets for separators separately, via parts.length. The
comment now says what the constant is.

Notes

  • Comments only. No behaviour changes, and the diff contains no non-comment
    lines.
  • bundle exec rake test: 69 examples, 0 failures, unchanged from main.
  • bundle exec cookstyle --chefstyle (Cookstyle 9.0.0 / RuboCop 1.90.0):
    9 files inspected, no offenses detected.
  • The doc and doc_coverage rake tasks and .yardopts already existed and
    are untouched; both tasks were run and still report 100.00% documented.
  • Merges cleanly into feat: replace fog-cloudstack with cloudstack_client #62 with no conflicts (verified by a trial merge). Every
    docstring changed here describes a method feat: replace fog-cloudstack with cloudstack_client #62 keeps, and the wording stays
    accurate after that PR's rewrite.

The YARD docstrings covered every method but largely stopped short of
documenting what each one hands back. Adds a @return to the 19 methods
and attributes that lacked one, so `yard` over the .yardopts scope
(which includes --private --protected) now reports no method without a
documented return value.

Private attr_readers are documented with @!attribute directives, which
lets each reader on a shared attr_reader line carry its own type rather
than sharing one docstring.

Also corrects the SUFFIX_LENGTH comment in ServerOptions, which claimed
the constant covered the suffix's separator. It does not: generate_name
budgets for separators separately, via parts.length.

Signed-off-by: Tim Smith <tim@mondoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant