-
Notifications
You must be signed in to change notification settings - Fork 212
Extend coverage feature #1072
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
Extend coverage feature #1072
Conversation
Hmm, I'm not sure we should count them as the same percentage - most people don't even know |
Yeah I'm also not sure about having them as the same percentage. If that ends up being the way we do it, we should at least include an asterisk somewhere to tell people how it's calculated. Don't want to cause unnecessary confusion. |
I still share @sunjay's concerns from #939 (comment) about this feature, but less so because it's not as prominent anymore. I'm quite wary of coming up with an arbitrary formula for this. What's the reasoning behind it? Why 80%? And yeah we should be transparent about it, or perhaps just include two different numbers? |
I agree, we should at least put the explanation of the computation somewhere. Just don't know where... As for why not two numbers: because the ultimate goal is to provide this information alongside crates search results (when you look for crates on docs.rs, not when you search something in a crate). |
I wouldn't include examples in the percentage, as for a lot of items examples are just noise. I think it's fine to display that number, but it shouldn't count for the %. |
Interesting argument! Do you have some examples in mind by any chance? |
I think a big example is builders (like |
The example in itself isn't useful but:
So it is definitely worth it having examples even then in my opinion. |
I feel like useless examples are just noise: if a crate author wants to add them that's fine, but we shouldn't encourage people to do so. |
Unfortunately, we can't have shades here: it's either we enforce it on everything (there are still items that aren't required by the lint and those are fines) or on nothing... Methods, types and functions should always be documented and have a code example. |
I agree that having an example on every item should not be necessary for the overall quality indicator. As another example I have this fully public error type which is shown in other examples. Adding an example on each variant (judging by the percentage shown public fields are not required to have examples?) would be useless extra detail clogging up the documentation. I personally consider this crate to be nearly 100% covered with examples (less adding some examples for the single item |
You're missing my point (also, at least one short example should be on the type directly with a link to the examples, but that's another debate): we can relax the rules later on, but currently, most crates are strongly lacking documentation. For some of them, it's fine (FFI ones), but it's problematic for all others. |
I very much disagree with the first half of this sentence (but the latter is definitely something I should add 😁). Actually testing adding empty examples to stuff it appears I was wrong about the variants being the source of low coverage. The problem is that I don't have examples on the types and instead link out to the more centralized documentation. (There does seem like 1 bug here that type aliases probably shouldn't be in the set of items that require examples?). |
It's open to debate. The option is still nightly (and will remain for some time I expect), so you can definitely open an issue on the rust repository so it can be discussed. But yes, fields and variants are excluded from this count. ;) |
I think that especially since this option is experimental and changing rapidly, we should not put it front and center on the /crate page. I'd be fine with listing the number of examples: But not with showing the percentage: And certainly not by including the examples in the 'overall documentation' percentage: @GuillaumeGomez does that first option sound reasonable to you? |
I'm not too strongly in favor of merging both results in the computed percentage, even though I think we should. For now we can simply show the numbers. The important part for me is to have the data available so we can use it later on. If it's fine with you, I'll then keep the display of the example numbers (not the percentage) and remove it from the total percentage computation. |
Sounds like a plan :) |
ef99082
to
a44e6a9
Compare
Updated! |
04ef20b
to
e4fc371
Compare
I am very strongly against this, for the reasons @sunjay articulated in #939 (comment) (also @yaahc's comment in #939 (comment)). I do not think we should engineer a race-for-metrics via some coverage number. I was under the impression that based on discussion in the other thread this was no longer the goal. I've already heard people complaining about flaws in lib.rs' ranking algorithm, and of crates sometimes doing things that don't improve them to improve their "score" If this is the direction we're going in I'd like to see a holistic plan (instead of incremental changes), and, ideally, an RFC. |
I strongly agree with what Manish said. I am also very against putting this in the search results for every crate. A proposal I could get on board with:
That way people can have the metric and choose where they want it to be displayed. It's a win-win. Overall, I don't think this is a bad feature. It makes sense to provide metrics like this just like it makes sense to provide people with the ability to generate code coverage reports. I just think that people shouldn't be forced into having to care about a number that they might not care about and that doesn't even accurately represent the quality of their crate. Putting this number in the search results would definitely be overstating its importance. I think Manish put it perfectly when he said:
I completely agree with this. |
This isn't supposed to impact ranking, just a visual indication alongside the crate. |
Yes, I'm aware, but when it's prominent in search results people will still optimize for it, and this creates negative reinforcement. We should avoid negative reinforcement, regardless of the desired outcome being a good thing. I want people to write more docs. I do not wish to sneakily browbeat them into doing it by setting up such incentives. It's not respectful of the community, and this kind of thing rarely works the way it was intended to. There already are people going around bugging maintainers into add |
Hum, I see... I'm shared on this. I mean: it sounds good to have more documentation overall. However, you bring up a good concerning point: this is an easy-to-trick metric and people will very likely optimize for it. This is really sad. :-/ I didn't want to put this information alongside a crate's name before long, but maybe it's best to never do it even if it makes me sad... However, it can still be very interesting metrics to use for us. It could be useful to have extra information to help people improve their crate documentation when you have a download/documentation coverage ratio information. But this is all very far future. Anyway, thanks for bringing this up: this is definitely something where we need to be very careful. As for the PR, is there anything else I need to do? |
I think having it on the crate info page in docs.rs (where it is right now) is fine. It's not immediately prominent, and I think ultimately such a number is useful, we just don't want to surface it so prominently that people start overindexing on it. I think the current PR, where the examples are not included in the calculation, is fine. Worried about people getting confused but we can figure out precise styling later too, if this is actually a problem. |
e4fc371
to
2213af1
Compare
2213af1
to
693a0ea
Compare
Like we talked about some time ago, the doc examples have been added to rustdoc so we can now use them on docs.rs as well!
For information, I decided to go for this computation: the documentation itself is worth 80% of the rating, the doc examples is the remaining 20%.After debate, for now it won't be taken into account in the percentage computation.
Here is what it looks like: