docs: add missing @return tags to every method - #66
Open
tas50 wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
yard statsalready reported 100% documented, but that only counts whether adocstring exists. Measured over the
.yardoptsscope (which includes--private --protected), 19 of 61 methods and attributes documented what theytook and what they did, but never what they handed back.
Before:
After:
@paramcoverage was already complete, andyardreports no warnings beforeor after.
Private
attr_readersMost of the gap was private readers declared several to a line, such as
attr_reader :config, :client, :port, :logger. A single docstring above one ofthose statements gives every reader the same
@return, which would be wrongfor three of the four. YARD's attribute directives let each reader carry its
own type, but only when they follow the
attr_readerstatement -- attachingthem 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_LENGTHwas documented as "Random suffix appended togenerated names, plus its separator." It does not cover the separator:
generate_namebudgets for separators separately, viaparts.length. Thecomment now says what the constant is.
Notes
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.
docanddoc_coveragerake tasks and.yardoptsalready existed andare untouched; both tasks were run and still report 100.00% documented.
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.