r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 753 forks source link

submit_cran should check for outdated date fields #2418

Closed mbannert closed 2 years ago

mbannert commented 2 years ago

Is your feature request related to a problem? Please describe. I'm always frustrated when I r-devel check everything for a CRAN submission and I forget to make sure the date field in DESCRIPTION is updated. Unfortunately, I submitted more than once with a date field older than a month and therefore got rejected with everything else fine, causing unnecessary for the CRAN team and frustration for myself.

Describe the solution you'd like I thought it would be cool if submit_cran would have warned me and prevented me from pushing up to CRAN. Something like adding the below code to https://github.com/r-lib/devtools/blob/56875888a507eedb1a92d820ff8c899e065e653c/R/release.R#L270

would do the job.

# the force submission if clause is entirely optional to the idea 
# and would allow to force pushes from environments with weird Sys.Date()
if(!force_submission){
  desc_date_diff <- as.Date(desc::desc_get_field("Date")) -
    Sys.Date()

  if(desc_date_diff > 28){
    message("Date field in DESCRIPTION may be older than a month compared to Sys.Date(). Aborting upload. This may lead to a CRAN rejection.")
    return(NULL)
  }
}

Alternatively to checking Sys.Date() one could check some online date service.

If desired I can create a PR, but thought raising the issue first makes sense.

jennybc commented 2 years ago

I'm going to say that devtools actively discourages explicit inclusion and manual management of a Date field. It's better to just remove it and it will be generated at the right time, with correct data, without any effort on your part. I live a life completely free of even thinking about this field in the packages I maintain.

I will quote my colleagues on this one 😁 πŸ“†

https://twitter.com/jimhester_/status/1143335673535094784

PSA: just remove the date field entirely, R CMD build will add it for you automatically

https://twitter.com/hadleywickham/status/1143492132503719936

Actual PSA: Friends don't let friends use the Date field