lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

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

Open thomthom opened 2 years ago

thomthom commented 2 years ago

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.

lsegal commented 2 years ago

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.

thomthom commented 2 years ago

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?)