Skip to content

Create a "Well documented" badge for crates in the top 20% #703

@carols10cents

Description

@carols10cents

Part of RFC 1824, rust-lang/rust#41616.

"Well Documented" badge implementation

For each crate published, in a background job, unpack the crate files and
calculate the ratio of lines of documentation to lines of code as follows:

  • Find the number of lines of documentation in Rust files:
    grep -r "//[!/]" --binary-files=without-match --include=*.rs . | wc -l
  • Find the number of lines in the README file, if specified in Cargo.toml
  • Find the number of lines in Rust files: find . -name '*.rs' | xargs wc -l

We would then add the lines in the README to the lines of documentation,
subtract the lines of documentation from the total lines of code, and divide
the lines of documentation by the lines of non-documentation in order to get
the ratio of documentation to code. Test code (and any documentation within
test code) is part of this calculation.

Any crate getting in the top 20% of all crates would get a badge saying "well
documented".

Please let me know if you have any questions, potential implementers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancement ✨Category: Adding new behavior or a change to the way an existing feature works

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions