Skip to content

docs: complete the YARD tags on connection and run_command - #499

Merged
tas50 merged 1 commit into
mainfrom
docs/complete-yard-tags
Aug 30, 2026
Merged

docs: complete the YARD tags on connection and run_command#499
tas50 merged 1 commit into
mainfrom
docs/complete-yard-tags

Conversation

@tas50

@tas50 tas50 commented Aug 30, 2026

Copy link
Copy Markdown
Member

Two documentation tag fixes found by auditing every method in lib/ against its real signature.

yard stats already reports 100.00% documented, but that number counts any docstring at all, so it does not catch a tag that is missing or a tag that names a class which does not exist. Auditing the parsed registry instead of the coverage percentage turns those up.

Transport::Docker#connection was missing @param block

The method is def connection(state, &block), but only state was documented, so the block did not appear in the generated signature. It is now documented as what it actually is: a proc forwarded to Connection.new, which yields the new connection to it. Worth stating explicitly that the connection is not closed when the block returns — Kitchen::Transport::Base::Connection#initialize only does yield self if block_given?.

CliHelper#run_command named a class that does not exist

The tag read @raise [Kitchen::ShellCommandFailed]. There is no such constant:

$ ruby -r kitchen -e 'Kitchen::ShellCommandFailed'
NameError: uninitialized constant Kitchen::ShellCommandFailed

The method raises a bare ShellCommandFailed, which resolves through the include ShellOut in CliHelper to Kitchen::ShellOut::ShellCommandFailed:

$ ruby -r kitchen/docker/helpers/cli_helper \
    -e 'puts Kitchen::Docker::Helpers::CliHelper.const_get(:ShellCommandFailed).name'
Kitchen::ShellOut::ShellCommandFailed

A type name that does not resolve renders as plain text rather than a link, so the tag pointed nowhere.

Verification

Auditing all 91 methods in the .yardopts scope (which includes --private --protected) for parameters absent from the @param tags:

before:  methods=91  missing_@param=1  missing_@return=0
after:   methods=91  missing_@param=0  missing_@return=0

yard emits no warnings before or after. lib/ was also swept for the other shapes of bad type name — Array[T] where YARD spells a list Array<T>, Hash[...] where it wants Hash{K => V}, and namespaced constants whose casing does not match the real class. Kitchen::ShellCommandFailed was the only hit; every other referenced constant resolves.

The doc and doc_coverage rake tasks already existed and still run clean.

$ bundle exec rake test
360 examples, 0 failures

$ cookstyle --chefstyle          # 9.0.0
44 files inspected, no offenses detected

Comments only — no behaviour change, and the test count is unchanged.

`Transport::Docker#connection` accepts a block but only documented its
`state` argument, so the block was missing from the generated signature.
Document it as what it is: a proc forwarded to the connection's
constructor, which yields the new connection to it without closing it.

`CliHelper#run_command` documented its `@raise` as
`Kitchen::ShellCommandFailed`, which is not a class that exists. The bare
`ShellCommandFailed` the method raises resolves through the included
`Kitchen::ShellOut` mixin to `Kitchen::ShellOut::ShellCommandFailed`, so
the tag rendered as an unlinked literal instead of a link to the real
class.

Comments only; no behaviour change.

Signed-off-by: Tim Smith <tim@mondoo.com>

@RulerOf RulerOf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tas50
tas50 merged commit 1c8dcda into main Aug 30, 2026
8 checks passed
@tas50
tas50 deleted the docs/complete-yard-tags branch August 30, 2026 03:16
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.

2 participants