-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility of moving to YARD-style documentation in README #1330
Comments
YARD documentation is supported in RubyMine, and I think VS Code as support for it as well. |
I've started to add YARD style docs. an example can be seen here: |
I really like this. Who's willing to take up the challenge of converting all the docs? :) |
I don't think that there necessarily needs to be a conversion effort to move all of the documentation immediately, though that would certainly be the dream :). I was more envisioning a discussion here about which YARD documentation elements should be required, how/where to go about documenting those in the CONTRIBUTING.md, and then how to go about enforcing those documentation requirements for every new pull request before it is allowed to be merged. |
I agree with that, we can ask existing/new pull requests that haven't been merged yet to include YARD doc blocks. An full example would be: ##
# @return [string] A hex string
#
# @param length [integer] Length of the string
# @param upcase [boolean] Upcase the letters
#
# @example Faker::Example.hex
# "d6964ad8b71d46a62e5e64cd00b9e476"
# "955b1fdf9971cda5745604ab081cc61d"
# "73d3dc6fa0ba67911024d61eb6c1e382"
# @example Faker::Example.hex(length: 10)
# "170b43193e"
# "181450a4ae"
# "d7b0a72da6"
# @example Faker::Example.hex(upcase: true)
# "4BE0CB215BE62A06306BF21872EA9603"
# "8A73D1E0BB69E3A5388EA0E340A0B0D9"
# "F0C078EECFFCA394336F93B54D6CDE24"
#
# @faker.version next
def hex(length: 32, upcase: false) |
I know that YARD also allows for us to specify our own CSS for the documentation, so we could so some fancy things with that, but i haven't yet delved into that. |
A few comments on the proposed format provided by @SpyMaster356 :
|
|
I'm not sure about the String resolution issue off the top of my head, but maybe prefixing it like Everything else makes perfect sense to me and I agree with your approach, for whatever that's worth to the group :) |
So an updated example: ##
# Produces a random hexadecimal string
#
# @return [string]
#
# @param length [integer] Length of the string
# @param upcase [boolean] Upcase the letters
#
# @example Faker::Example.hex
# "d6964ad8b71d46a62e5e64cd00b9e476"
# "955b1fdf9971cda5745604ab081cc61d"
# "73d3dc6fa0ba67911024d61eb6c1e382"
# @example Faker::Example.hex(length: 10)
# "170b43193e"
# "181450a4ae"
# "d7b0a72da6"
# @example Faker::Example.hex(upcase: true)
# "4BE0CB215BE62A06306BF21872EA9603"
# "8A73D1E0BB69E3A5388EA0E340A0B0D9"
# "F0C078EECFFCA394336F93B54D6CDE24"
#
# @faker.version next
def hex(length: 32, upcase: false) |
One thing that we should discuss is the number of examples that are required. A few ideas for that:
|
I'm fine with requiring just one example and encouraging examples for optional arguments. |
I don't think anything more than 1 example showing the main use case should be required (of course, the more the better). The |
For me, I think each usage should have at least one example, as that can speak more about what will be generated. But generally |
Oh cool, Rubocop has a documentation cop, we could make use of that once all the methods are documented. |
When utilizing YARD for documentation, I've found the It seems like we've got enough of a start here to open up a pull request. Does it make sense to include these guidelines in CONTRIBUTING.md, or is it worth having something like a DOCUMENTATION.md document that can be linked from CONTRIBUTING.md? |
To me, having the new documentation style as part of CONTRIBUTING.md makes the most sense to me. And looking at the file, it actually doesn't mention documentation at all >.< Adding the check to ensure that the documentation level doesn't drop (btw, currently sits at 7% excluding Sounds good to you @stympy? |
That works for me. |
@stephendolan i've already started a bit on my fork here: https://github.com/SpyMaster356/faker/tree/yard-powered-docs |
Just so I'm clear @SpyMaster356 , are you submitting the initial pull request, or should I? |
We could work off of my fork as it's already got Yard added, and some basic setup done. Up to you, as you opened this thread. On another note, using |
Should i open the pull request @stephendolan? |
I'm happy to open one, @SpyMaster356 . It will just be the week of March 8th before I can devote the time to getting it done correctly. If we'd like to see progress before then, someone else will have to open the PR. We've got a big release at work this week, followed by a big vacation for me :D. |
Have fun on the vacation. I'll open a PR for the stuff i have on my fork. |
* install Yard * add some basic docs to test with * and go go gadget yard * Revert "and go go gadget yard" This reverts commit b2c8000. * use square brackets not braces * fully document Faker::Blockchain * exclude deprecated methods * add version numbers to blockchain * update documentation to match what was discussed in #1330 * remove class level @faker.version from docs * update CONTRIBUTING.md * add documentation to Alphanumeric * consistently use braces for types * document the Books namespace * add doc url * Add yard docs for Faker::Blockchain::Tezos.block * update docs for named params * convert back to [] for types Although YARD supports any kind of bracket for the Typing, square brackets are used in the documentation. For those contributing, and unfamiliar with YARD, it would be best that our documentation matches the same style as that in YARD's tutorials and documentation. * document Faker::Creature::Animal * document Faker::Creature::Cat * document Faker::Creature::Dog * document Faker::Creature::Horse * Update lib/faker/default/alphanumeric.rb Co-Authored-By: Connor Shea <[email protected]> * Update lib/faker/creature/dog.rb Co-Authored-By: Connor Shea <[email protected]> * document Faker::Game * document Faker::Games::HalfLife * document Faker::Games::Zelda * document Faker::Games::SuperSmashBros * document Faker::TvShows::BreakingBad * Document Faker::Games::ElderScrolls * document Faker::Gender * document Faker::House * document Faker::ProgrammingLanguage * document Faker::Source * Update some of the docs to use examples without titles. * Update a few more docs to use examples without titles. * Update more docs to use title-less examples. * document Faker::Boolean * document Faker::Avatar * document Faker::Games::Fallout * document Faker::Games::Overwatch * document Faker::Hacker * Fix a method description. * Remove trailing whitespace. * document Faker::App * Add faker version for BreakingBad methods. * Add faker version to Zelda methods. * document Faker::Artist * Merge the examples for semantic_version in app.rb. * Add faker versions for elder_scrolls.rb and fallout.rb. Some of the Elder Scrolls methods were added after others, in 1.9.0. * Update version tags in Elder Scrolls and Fallout. * Clean up docs Co-Authored-By: Connor Shea <[email protected]> Update CONTRIBUTING.md to match new example format install Yard and go go gadget yard Revert "and go go gadget yard" This reverts commit b2c8000. fully document Faker::Blockchain exclude deprecated methods add version numbers to blockchain update documentation to match what was discussed in #1330 remove class level @faker.version from docs update CONTRIBUTING.md update existing yard docs clean up some of the docs * fix line ending issues
* install Yard * add some basic docs to test with * and go go gadget yard * Revert "and go go gadget yard" This reverts commit b2c8000. * use square brackets not braces * fully document Faker::Blockchain * exclude deprecated methods * add version numbers to blockchain * update documentation to match what was discussed in faker-ruby#1330 * remove class level @faker.version from docs * update CONTRIBUTING.md * add documentation to Alphanumeric * consistently use braces for types * document the Books namespace * add doc url * Add yard docs for Faker::Blockchain::Tezos.block * update docs for named params * convert back to [] for types Although YARD supports any kind of bracket for the Typing, square brackets are used in the documentation. For those contributing, and unfamiliar with YARD, it would be best that our documentation matches the same style as that in YARD's tutorials and documentation. * document Faker::Creature::Animal * document Faker::Creature::Cat * document Faker::Creature::Dog * document Faker::Creature::Horse * Update lib/faker/default/alphanumeric.rb Co-Authored-By: Connor Shea <[email protected]> * Update lib/faker/creature/dog.rb Co-Authored-By: Connor Shea <[email protected]> * document Faker::Game * document Faker::Games::HalfLife * document Faker::Games::Zelda * document Faker::Games::SuperSmashBros * document Faker::TvShows::BreakingBad * Document Faker::Games::ElderScrolls * document Faker::Gender * document Faker::House * document Faker::ProgrammingLanguage * document Faker::Source * Update some of the docs to use examples without titles. * Update a few more docs to use examples without titles. * Update more docs to use title-less examples. * document Faker::Boolean * document Faker::Avatar * document Faker::Games::Fallout * document Faker::Games::Overwatch * document Faker::Hacker * Fix a method description. * Remove trailing whitespace. * document Faker::App * Add faker version for BreakingBad methods. * Add faker version to Zelda methods. * document Faker::Artist * Merge the examples for semantic_version in app.rb. * Add faker versions for elder_scrolls.rb and fallout.rb. Some of the Elder Scrolls methods were added after others, in 1.9.0. * Update version tags in Elder Scrolls and Fallout. * Clean up docs Co-Authored-By: Connor Shea <[email protected]> Update CONTRIBUTING.md to match new example format install Yard and go go gadget yard Revert "and go go gadget yard" This reverts commit b2c8000. fully document Faker::Blockchain exclude deprecated methods add version numbers to blockchain update documentation to match what was discussed in faker-ruby#1330 remove class level @faker.version from docs update CONTRIBUTING.md update existing yard docs clean up some of the docs * fix line ending issues
* install Yard * add some basic docs to test with * and go go gadget yard * Revert "and go go gadget yard" This reverts commit b2c8000. * use square brackets not braces * fully document Faker::Blockchain * exclude deprecated methods * add version numbers to blockchain * update documentation to match what was discussed in faker-ruby#1330 * remove class level @faker.version from docs * update CONTRIBUTING.md * add documentation to Alphanumeric * consistently use braces for types * document the Books namespace * add doc url * Add yard docs for Faker::Blockchain::Tezos.block * update docs for named params * convert back to [] for types Although YARD supports any kind of bracket for the Typing, square brackets are used in the documentation. For those contributing, and unfamiliar with YARD, it would be best that our documentation matches the same style as that in YARD's tutorials and documentation. * document Faker::Creature::Animal * document Faker::Creature::Cat * document Faker::Creature::Dog * document Faker::Creature::Horse * Update lib/faker/default/alphanumeric.rb Co-Authored-By: Connor Shea <[email protected]> * Update lib/faker/creature/dog.rb Co-Authored-By: Connor Shea <[email protected]> * document Faker::Game * document Faker::Games::HalfLife * document Faker::Games::Zelda * document Faker::Games::SuperSmashBros * document Faker::TvShows::BreakingBad * Document Faker::Games::ElderScrolls * document Faker::Gender * document Faker::House * document Faker::ProgrammingLanguage * document Faker::Source * Update some of the docs to use examples without titles. * Update a few more docs to use examples without titles. * Update more docs to use title-less examples. * document Faker::Boolean * document Faker::Avatar * document Faker::Games::Fallout * document Faker::Games::Overwatch * document Faker::Hacker * Fix a method description. * Remove trailing whitespace. * document Faker::App * Add faker version for BreakingBad methods. * Add faker version to Zelda methods. * document Faker::Artist * Merge the examples for semantic_version in app.rb. * Add faker versions for elder_scrolls.rb and fallout.rb. Some of the Elder Scrolls methods were added after others, in 1.9.0. * Update version tags in Elder Scrolls and Fallout. * Clean up docs Co-Authored-By: Connor Shea <[email protected]> Update CONTRIBUTING.md to match new example format install Yard and go go gadget yard Revert "and go go gadget yard" This reverts commit b2c8000. fully document Faker::Blockchain exclude deprecated methods add version numbers to blockchain update documentation to match what was discussed in faker-ruby#1330 remove class level @faker.version from docs update CONTRIBUTING.md update existing yard docs clean up some of the docs * fix line ending issues
I find some of the documentation and READMEs in this project relatively difficult to use. For example, in
Faker::Lorem
:There's nothing here specifying what the
supplemental
parameter does, and there's also no solid indication in the examples. Visiting the code itself isn't any more helpful:I ended up being able to most easily find the purpose of this parameter on this GitHub issue.
What I would expect in the README:
What I would expect in the code:
I wanted to start a discussion here to see whether or not there's an interest in beginning a larger effort to improve this library's documentation. It is such an excellent source of data that it is a shame to see any of its cool options hidden.
It's also entirely possible that I've missed an additional source of documentation somewhere :)
The text was updated successfully, but these errors were encountered: