-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Problem
I often cargo publish
an initial version of a crate without a README... by accident. This is because my naming convention for README files doesn't match what Cargo expects. (I'll open a second bug to ask about whether my convention is common enough to support, but, that's a different matter.)
I always run cargo publish -n
first and check for warnings. Cargo is very consistent about warning about missing repository
, documentation
, license
, and other fields, but does not warn if it can't find a README file and none is specified in the Cargo.toml
.
Proposed Solution
I'd like to include the readme
in the list of fields that cargo publish
warns about. (This list appears to be specific to publish
, from the source code.) It would be important for this check to be performed after readme autodetection, so that users who have a README named README.md
don't get hassled --- only those of us with README.somethingelse
.
If there's a real use case for publishing (not packaging!) crates without a README, and people want to do that without a warning, then this might not make sense without a way to suppress the warning.
Notes
In case you're curious, my convention is README.mkdn
. But that's not really material for this report.
Activity
weihanglo commentedon Feb 7, 2025
According to our current doc,
readme
is encouraged to be filled in. Cargo would also auto-detect from some paths when missing.Based on these facts, if we are not going to change the recommendation, I feel like it is reasonable to add README to metadata check.
epage commentedon Feb 7, 2025
The initial warning was for description and license (#902, #903). We later extended this to repository, homepage, and documentation (#998, #1053). In all of those discussion, I never saw any talk of README, for or against. Nor am I finding any other issues about this. I'm a bit surprised at that.
Generally, we take the stance that we shouldn't emit warnings without a reasonable way to turn them off until we have #12235. We didn't take that approach with those prior warnings, so maybe thats fine here. One way to soften this is to only warn if the field is
None
so people can setpackage.readme = false
to disable it.cbiffle commentedon Feb 7, 2025
Ooooh, I like
package.readme = false
as a mechanism for explicitly stating that no, thank you, I really don't want to have a readme.weihanglo commentedon Feb 7, 2025
We have
--no-metdata
oncargo package
but not oncargo publish
. Wonder if we should also replicate it tocargo publish
.epage commentedon Feb 7, 2025
I forget that
--no-metadata
exists. I feel like #12235 is close enough that we should focus on that.