Closed kevinushey closed 1 month ago
cc @gaborcsardi
(I haven't thought about this yet, but looped you in because of the connection to desc.)
I note that usethis also puts an invalid license in as a default, which doesn't seem to cause a problem:
https://github.com/r-lib/usethis/blob/2cc9e5a4e5e3034399fafb65d871eec352d83a15/R/description.R#L128
The basic mindset is that we're scaffolding and we're fine with the user seeing a note, warning, or error the first time that they do R CMD check
. That is their nudge to modify such fields (e.g. License
and the ORCID in person()
).
However it looks like some new behaviour in r-devel causes a warning at package creation time, which I don't want. (This wasn't clear to me from #2059, which only reported a warning at package build time.)
This is also causing build failures for usethis.
The check looks pretty robust:
So I don't see an obvious to construct an obviously fake ORCID that would still pass the test.
It would be a bummer to drop the ORCID from the scaffold, because I'm convinced that will lead to less usage of the field. But we might not have a choice?
We can try to work around this in desc, but it is tricky, because we definitely want to catch the case when the user forgets to fill in the correct values. Ideally, the warning would show up in R CMD check
only, maybe?
Or maybe we can use a real orcid for a fake person, e.g. https://orcid.org/0000-0002-1825-0097
But then we'd need a way to catch this ORCID when R CMD check
-ing the package. Maybe we could contribute this to base R?
I made a credible start on insulating usethis from this new check. But I was having to apply so much suppressWarnings()
and gymnastics in the tests that I have concluded the best way forward is to drop the placeholder ORCID identifier from the default DESCRIPTION fields.
Recording a few findings here, in case it's useful in the future.
Putting this tidy_desc()
call inside suppressWarnings()
is 85% of the "solution" to dealing with the new warning:
https://github.com/r-lib/usethis/blob/a9afa2cb7578de6d6efaa5835cb83d570115de6f/R/proj-desc.R#L18
But the other 15% to really finish the job is sufficiently yucky that I'm not doing it.
Overview of ORCID identifiers: https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier#:~:text=ORCID%20iDs%20are%20assigned%20randomly,%2D0010%2D0000%2D0000.
This whitepaper explains the structure of ORCID identifiers and, at the very end, gives 3 that are fake but well-formed: https://docs.google.com/document/d/1awd6PPguRAdZsC6CKpFSSSu1dulliT8E3kHwIJ3tD5o/edit?tab=t.0#heading=h.n4gh01ccn1yv
These fake ORCIDs would be safe to use as placeholder ORCIDs, in terms of not triggering R's new warning in utils::person()
. But they would be unsafe to use as a placeholder in terms of actual R package devs not realizing they are a placeholder.
To reproduce, try running the following from a shell:
I see:
Note that warning messages emitted about the invalid ORCID iD. I bumped into this with an
renv
test that was usingcreate_package()
; here's the associated backtrace.The warning appears to be emitted from the
desc
package, whendesc$normalize()
is called. I'm not sure whether this is better resolved inusethis
ordesc
, though.