yard icon indicating copy to clipboard operation
yard copied to clipboard

Question: Does `yard stats` generate docs like `yard doc`?

Open thomthom opened this issue 3 years ago • 2 comments

It appear that when I run yard stats --list-undoc the generated HTML output is also updated, like when I run yard doc.

Is this something that can be relied on? The reason is that I find it useful to see what isn't documented. Generating and providing a verbose description of what isn't documented all in one command is convenient.

But the CLI docs for yard stats says:

Prints documentation statistics on a set of files

Which to me kindof indicate that it should only print stats to the console. Generating HTML output at the same time sounds like an unintended side-effect with that wording.

thomthom avatar Jun 17 '22 16:06 thomthom

Sorry for missing this.

The stats command should not generate docs. This would be a bug if it actually works that way, but afaik this is not standard behavior. Could a plugin be interfering with the default command logic? If not, can you provide a minimal reproduction? I cannot seem to reproduce this on any codebase I have.

lsegal avatar Jul 21 '22 07:07 lsegal

I checked again. and I think my original description wasn't entirely accurate. With a clean project, yard stats --list-undoc only generate .yardoc.

However, this Rake task will generate docs:

  YARD::Rake::YardocTask.new(:doc) do |task|
    task.stats_options << '--list-undoc'
  end

Since --list-undoc isn't a valid option for yard doc and this Rake task didn't yield a warning with task.stats_options << '--list-undoc' I thought it was calling yard stats when stats_options was used.

I'm guessing the YARD task is simply acting slightly different than the CLI command - allowing stats.

I actually like, and want, list of undocumented items when I generate the docs, so the current Rake task behaviour is a nice thing. (No option to return error exit code upon undocumented items?)

thomthom avatar Jul 24 '22 13:07 thomthom