-
Notifications
You must be signed in to change notification settings - Fork 182
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
Lint missing docs in icu_datetime #725
Conversation
Codecov Report
@@ Coverage Diff @@
## main #725 +/- ##
==========================================
- Coverage 74.68% 74.66% -0.03%
==========================================
Files 178 178
Lines 10710 10712 +2
==========================================
- Hits 7999 7998 -1
- Misses 2711 2714 +3
Continue to review full report at Codecov.
|
Pull Request Test Coverage Report for Build cce347fb872c76e3729b471c5a9707f5ad4398c5-PR-725
💛 - Coveralls |
I think we should merge this with the docs Greg wrote, even if they aren't comprehensive. It's a step in the right direction, and better to be merged than to sit in a PR. |
b6df5ad
to
2f6c63b
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
I finished either filling in the docs or adding suppressions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, pending a few minor comments.
@@ -270,6 +288,7 @@ pub struct DayOfYearInfo { | |||
/// assert_eq!(7, IsoWeekday::Sunday as usize); | |||
/// ``` | |||
#[derive(Clone, Copy, Debug, PartialEq, Eq)] | |||
#[allow(missing_docs)] // The weekday variants should be self-obvious. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question
This has a doc comment. Why is the linter saying it's missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All fields require doc comments. Here the comments wouldn't add any more meaning.
e.g.
/// ...
pub enum IsoWeekday {
/// This is a Monday!
Monday = 1,
....
}
pub mod key { | ||
use icu_provider::{resource_key, ResourceKey}; | ||
|
||
/// A [`ResourceKey`](icu_provider::prelude::ResourceKey) to | ||
/// [`gregory::DatesV1`](crate::provider::gregory::DatePatternsV1). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought
I've been thinking a bit about our documentation style. Manually linking these keywords can be very verbose, tedious, and pain to maintain if the paths ever change.
Question
How do you feel about adding a doc-only use
declaration to the top of the file?
e.g.
#[cfg(doc)]
use {
crate::provider::{
gregory::{DatePatternsV1, DateSymbolsV1},
time_zones::{
ExemplarCitiesV1, MetaZoneGenericNamesLongV1, MetaZoneGenericNamesShortV1,
MetaZoneSpecificNamesLongV1, MetaZoneSpecificNamesShortV1, TimeZoneFormatsV1,
},
},
icu_provider::prelude::ResourceKey,
};
Then your comment could just be
/// A [`ResourceKey`] to [`DatePatternsV1`].
We would only need to re-link it if we wanted to explicitly rename it, and even then there are no paths to deal with, so it still looks clean:
/// A [`ResourceKey`] to [`DatesV1`](DatePatternsV1).
I think this style would really unclutter our documentation. I think it's nice to have all the doc-only dependencies in one spot. I think it's also nice that it gives readers of the file some intuition of related modules, even though they aren't directly included as dependencies when building the code itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that would be great, and they should hopefully be checked by the compiler.
2f6c63b
to
1394c87
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
This is an initial stab at #686 for icu_datetime. There are still lots of docs to write here.