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

Allow machine readable output of documentation stats #1046

Closed joerg closed 7 years ago

joerg commented 7 years ago

Currently the doc stats are text only and are quite hard to parse into anything machine readable. I did some changes for my yard plugin [1] to output JSON instead of the text. This would allow other APIs etc. to show something like "How well is my gem documented". The implementation is quite simple [2] as there would simply be an output_text and an output_json instead of the current output definition. An option can then set an alias for whichever output should be used. The print_statistics will then either just print the output_text or collect all results from output_json and print a final collected json.

Would you be interested in such a feature? I could send you a pull request if so.

[1] https://github.com/chefdoc/yard-chefdoc [2] https://github.com/chefdoc/yard-chefdoc/blob/feature_stats_generation/lib/yard/cli/stats.rb

lsegal commented 7 years ago

I think this would serve better as a plugin, IMO. JSON might be machine readable, but it wouldn't exactly be "shell readable", which is what I would expect to be the use case for machine readable output (since heftier programming languages can use the YARD API programmatically).

I would recommend creating a plugin just for output-- if there is significant interest in that plugin, there will be a better case to be made about merging the plugin into YARD's core codebase.

joerg commented 7 years ago

A plugin sounds good too. Will do so, thanks.