Skip to content
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

[rustdoc] When calculating docs percentage, ignore items marked allow(missing_docs) #76121

Closed
Lokathor opened this issue Aug 30, 2020 · 4 comments · Fixed by #76196
Closed

[rustdoc] When calculating docs percentage, ignore items marked allow(missing_docs) #76121

Lokathor opened this issue Aug 30, 2020 · 4 comments · Fixed by #76196
Labels
A-doc-coverage Area: Calculating how much of a crate has documentation C-feature-request Category: A feature request, i.e: not implemented / a PR. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Lokathor
Copy link
Contributor

Request

The --show-coverage unstable option should not count items marked as allow(missing_docs) when calculating the docs percentage.

Use Case

I have a crate full of "bitfield" types, where the useful data is bit packed into integers (example). Each pseudo-field has a getter and a setter. I would like to document the getters, but the setters simply match the associated getter, and additional words on them would only serve to distract.

Accordingly, the getters are marked as allow(missing_docs), and they shouldn't count towards the docs coverage.

@jyn514 jyn514 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. A-doc-coverage Area: Calculating how much of a crate has documentation labels Aug 30, 2020
@jyn514
Copy link
Member

jyn514 commented Aug 30, 2020

Mentoring instructions: Add a new argument should_have_docs: bool to fn count_item:


Then pass in whether the item has allow(missing_docs), which can be found from attrs:
let has_docs = !i.attrs.doc_strings.is_empty();

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Aug 30, 2020
@GuillaumeGomez
Copy link
Member

It's not only should_have_docs: it shouldn't be counted as an item either.

@r-52
Copy link
Contributor

r-52 commented Aug 31, 2020

@jyn514 / @Lokathor could I take a look at this one, please?

@GuillaumeGomez
Copy link
Member

Go ahead.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Oct 13, 2020
… r=jyn514

rustdoc: skip #[allow(missing docs)] for docs in coverage report

During the document coverage reporting with:
```bash
rustdoc something.rs -Z unstable-options --show-coverage
```

the coverage report counts code that is marked with `#[allow(missing_docs)]` for the calculation, which outputs lower numbers in the coverage report even though these parts should be ignored for the calculation.

Right now I'm not sure how this can be tested (CI)? (I verified it by hand and ran the unit tests)

r? @jyn514

**Reference:** Fixes rust-lang#76121
@bors bors closed this as completed in 4d63435 Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doc-coverage Area: Calculating how much of a crate has documentation C-feature-request Category: A feature request, i.e: not implemented / a PR. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants