• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

extrachecks

This is a place to dump extra ad-hoc checks that CRAN does that are not checked for by devtools::check(). Some of them are generally useful, some of them are highly specific, but all of them are reasons that an R package has been rejected by CRAN. The hope is that by making them public, we can lower the number of rejections by making package developers more informed.

If you come across an ad-hoc check that isnā€™t on this list, please feel free to open an issue describing it, or submit a PR!

You have an un-exported function that you wrote a roxygen example section for

If you have written a roxygen example section for un-exported functions, your example section must call those functions with ::: like pkg:::my_fun().

Alternatively, you can use the roxygen tag @noRd to suppress the creation of the .Rd file.

You used \dontrun{} in an example and got a note about that

\dontrun{} should only be used if the example really cannot be executed (e.g.Ā because of missing additional software, missing API keys, ā€¦) by the user. If you want to include an example that errors, and you want to show the error, wrap the call in try().

Sometimes it is useful to create a custom predicate function (e.g.Ā googlesheets4::sheets_has_token()) that tests for a prerequisite. Then such examples can be placed inside an if () {... instead of \dontrun{}. Instead of a custom predicate, sometimes interactive() can be used as the condition.

You have exported functions that donā€™t have return value documentation

This is a fairly new check that CRAN is being much stricter on. You must provide return value documentation for all exported functions now. If you use roxygen2, use the tag @return.

This note is applicable even if your function is marked internal with @keywords internal.

This note is also applicable if your function has no return value: ā€œIf a function does not return a value, please document that too, e.g.Ā \value{None}.ā€

You have exported functions that donā€™t have examples

This is similar to the problem about return value documentation, but slightly less strict. If your exported function has a meaningful return value, then it will almost definitely require an examples section. Use the roxygen2 tag @examples to create one.

This note is applicable even if your function is marked internal with @keywords internal.

I have seen exceptions with functions that are used for their side effects. For example, hardhat::create_modeling_package() creates a new directory, which you would not want to include in an example section (which CRAN runs in their regular checks). I didnā€™t include any examples there, and it was accepted.

You fail a noSuggests check

Occasionally CRAN might decide to run their noSuggests check on your package. This will run an R CMD check on your package without any Suggests packages installed, which means that examples and tests that rely on them can break if not guarded against properly. We donā€™t typically worry about this much, because CRAN rarely enforces this, but if they do, you can use the following techniques:

  • For an individual example, you can use an if block like if (rlang::is_installed("pkg")) { to protect code that relies on a suggested package from running if the package isnā€™t installed.

  • For an entire example section that relies on "pkg" being installed, you can use the roxygen2 tag @examplesIf (like this @examplesIf rlang::is_installed("pkg")) to avoid running any examples in that section if the package isnā€™t installed.

  • For tests, use testthat::skip_if_not_installed().

  • Additionally, you can use this GitHub Action which mimics a noSuggests run by CRAN to ensure that you pass a check when no suggested packages are installed.

The noSuggests requirement also applies to recursive dependencies. For example, if your package uses sf::read_sf(), that requires the tibble package, but sf only Suggests it, so you need to guard against this appropriately in your package.

Your package DESCRIPTION Title is flagged

There can be a number of problems here:

  • You must use title case with package Titles, generally capitalizing all words except articles like ā€˜aā€™ and ā€˜theā€™. Base Rā€™s toTitleCase() might help with formatting.

  • Iā€™ve been flagged for a ā€œredundantā€ title.

    • I had ā€œA Toolkit for the Construction of Modeling Packagesā€ which was flagged since ā€œToolkit forā€ seemed redundant. I changed it to ā€œConstruct Modeling Packagesā€ and was accepted.
    • I had ā€œCommand Argument Parsing for Rā€ flagged because of the, admittedly, redundant ā€œfor Rā€.
  • You generally have to put all software and R package names in single quotes, this rule also applies to the Description section. For example, the riingo package is an interface to Tiingoā€™s stock price api: https://github.com/business-science/riingo/blob/a19c662d9a2acb526a15d119e00afcd3fdc7c24c/DESCRIPTION#L3

  • An initial package submission was rejected with the request to reduce the length of the title to less than 65 characters.

Your package DESCRIPTION Description is flagged

There can be a number of problems here:

Do not start the description with ā€œThis packageā€, package name, title or ā€œFunctions forā€.

While it may be intuitive to start a description this way, they are actually not allowed. For example, instead of ā€œthis package renders slides to different formatsā€¦ā€ or ā€œfunctions for rendering slides to different formatsā€¦ā€, just use ā€œRender slides to different formatsā€¦ā€.

The Description field is intended to be a (one paragraph) description of what the package does and why it may be useful. Please elaborate.

In this case my description was 1 sentence, which I had to expand into a 3-4 sentence paragraph with a broader description of the types of problems the package intended to help with.

Please only double quote publication titles in the description of the DESCRIPTION file.

In this case I previously had a sentence that contained: ā€˜ā€¦, like ā€œthe first Monday of Decemberā€ā€™. I just removed the double quotes.

Functions do not need to be put in single quotes, just packages, software names and API names. ā€˜case_when()ā€™ -> case_when()

In the Description, function names should not be placed in quotes. This is reserved for packages and software names. Reported by @rossellhayes.

Please always explain all acronyms/abbreviations in the description text in the Description field of the DESCRIPTION file. e.g. X-SAMPA

In the Description, all acronyms must be fully expanded the first time they are mentioned, no matter how innocuous they seem. This acronym was expanded to ā€œExtended Speech Assessment Methods Phonetic Alphabetā€, which was then accepted by CRAN. Reported by @rossellhayes.

Please single quote software names.

In the Description, all package names, software names, and API names must be placed in single quotes, like ā€˜tidyrā€™. This includes R itself, which should be styled ā€˜Rā€™. This rule also applies to the Title section. For example, the riingo package is an interface to Tiingoā€™s stock price api: https://github.com/business-science/riingo/blob/a19c662d9a2acb526a15d119e00afcd3fdc7c24c/DESCRIPTION#L10-L11.

You get asked if there are any ā€œreferences describing the methods in your package.ā€

This comment normally comes as the following standard block of text:

If there are references describing the methods in your package, please add these in the description field of your DESCRIPTION file in the form authors (year) <doi:ā€¦> authors (year) <arXiv:ā€¦> authors (year, ISBN:ā€¦) or if those are not available: <https:ā€¦> with no space after ā€˜doi:ā€™, ā€˜arXiv:ā€™, ā€˜https:ā€™ and angle brackets for auto-linking. (If you want to add a title as well please put it in quotes: ā€œTitleā€)

If there are no references, just nicely reply to the email and tell them that you donā€™t have any. If this was the only note then it should be accepted soon after, without going through another full review.

I have not found a good way to get them to accept a new package without getting this note on the first round of checks. Possibly you could include a preemptive note about it in your cran-comments.md file, explaining that there are no references for the package.

You get asked about the LICENSE year

I worked on a package in 2019, and then sent it in in 2020. I got the following question back:

Should the year in the LICENSE file be updated?

I updated the license year to 2020 and resubmit the package in. I then nicely replied directly to my reviewer and thanked them for catching the year discrepancy, and then asked them if they could help me push the package through without needing another review, since that was the only change that had to be made.

You get asked about being the copyright holder (cph)

Submitted by @dirkschumacher, who got this comment:

You also seem to be a copyright holder [cph]. Please add this information to the Authors@R field.

Even if you are the only author and no other copyright information is given, always add a [cph] role to your Authors field.

You get told not to comment out code in your @examples section

I had originally commented out some code in an example that would otherwise modify the global state. I wanted to talk about the code without having the user accidentally run it. I received the following message on submission:

Examples/code lines in examples should never be commented out. Ideally find toy examples that can be regularly executed and checked. Lengthy examples (> 5 sec), can be wrapped in \donttest{}. If you donā€™t want your code to be executed but still visible to the user, use \dontrun{}.

I didnā€™t want any of these options, so I removed the code from the examples section entirely and just mentioned it in the @details section instead.

You get a note like ā€œPlease use fully specified URLs starting with the protocol, e.g.Ā https://ā€¦.ā€

CRAN checks for https URLs and will not allow any http links.

Reported by @pnovack-gottshall, who had two URLs that were flagged. The first was paleobiodb.org/, which was flagged because it needed https:// in front. The second was an http URL, which was flagged because it needed to be https.

You get a note like ā€œFound the following (possibly) invalid file URIā€

You might have a relative link that doesnā€™t exist in the actual built R package. Originally reported by @RMHogervorst, who had a link to CODE_OF_CONDUCT.md in the README, and received the following message:

Found the following (possibly) invalid file URI:
     URI: CODE_OF_CONDUCT.md
       From: README.md

In this case, the .Rbuildignore file ignored the CODE_OF_CONDUCT.md file, so it didnā€™t exist after building the R package, meaning that the link didnā€™t work. This can probably be fixed by just removing this file from the .Rbuildignore. Alternatively, usethis::use_code_of_conduct() will generate a section to add to your README that doesnā€™t have any relative links.

You get a note like ā€œFound the following (possibly) invalid URLsā€

One of the most common causes for this is that you have a URL that redirects to another source. CRAN wonā€™t allow you to have redirects, so you might get a rejection that looks like this:

Found the following (possibly) invalid URLs:

URL: https://h3geo.org/docs/core-library/coordsystems#faceijk-coordinates
     (moved to https://h3geo.org/docs/core-library/coordsystems/)
From: inst/doc/intro-to-h3jsr.html
Status: 200
Message: OK

Please change http --> https, add trailing slashes, or follow moved
content as appropriate.

The problem here is that https://h3geo.org/docs/core-library/coordsystems#faceijk-coordinates redirects to https://h3geo.org/docs/core-library/coordsystems/. This was actually a typo, there was a forgotten / right before #faceijk.

To determine if you have any redirecting URLs, you can use urlchecker::url_check() to find them (and find what they redirect to) and urlchecker::url_update() to automatically update them to their redirected URL.

More Repositories

1

furrr

Apply Mapping Functions in Parallel using Futures
R
678
star
2

almanac

Tools for working with recurrence rules, holidays, and calendars
R
68
star
3

strapgod

"I'm beginning to feel like a strap god." - Eminem
R
62
star
4

so-you-want-to-use-rcpp

47
star
5

ivs

Interval Vectors
R
44
star
6

cbuild

Tools to Make Developing R Packages Interfacing with C Easier
R
42
star
7

cexport

What the Package Does (One Line, Title Case)
C
32
star
8

flyingfox

An R Interface to the Quantopian Zipline Financial Backtester
R
25
star
9

warp

Group Dates
R
22
star
10

extrachecks-html5

18
star
11

slides

All my presentations
HTML
14
star
12

multidplyr2

What the Package Does (One Line, Title Case)
R
13
star
13

fin-econ-project-bitcoin

HTML
12
star
14

2019-useR-workshop-design-for-humans

R
11
star
15

cross

Run Functions Across Package Versions
R
10
star
16

r-extensions

https://r-extensions.davisvaughan.com/
R
9
star
17

vcturrrs

Combining the Iteration of 'purrr' With the Type Stability of 'vctrs'
R
7
star
18

vacation

Holiday and Calendar Extensions for almanac
R
6
star
19

nodegraph

Infrastructure of node-based lazy matrix computation
R
5
star
20

xcursion

Examples With 'xtensor'
C++
4
star
21

calendarrr

An R frontend to the QuantLib Calendar API
C++
4
star
22

declair

What the Package Does (One Line, Title Case)
R
4
star
23

slidejoin

What the Package Does (One Line, Title Case)
R
4
star
24

addr

An R package with a C function - Complements the blog post ->
C
4
star
25

standardize

Standardize Subscripts
R
4
star
26

2020-06-01_dplyr-vctrs-compat

HTML
4
star
27

timerip

Rip Out Datetime Components
C
3
star
28

2019-04-19_duke-data-dialogue

3
star
29

machinegun

Provision Cloud Machines Preloaded With 'Docker'
R
3
star
30

rstudio-conf-2020

R
3
star
31

almanac-old

Tools for adjusting dates according to business calendars and holidays
C++
3
star
32

r-tree-sitter

C
3
star
33

hybridfire

What the Package Does (One Line, Title Case)
R
2
star
34

tidying-excel-cashflows-blog-companion

HTML
2
star
35

2019-04-12_unc-charlotte-demo

JavaScript
2
star
36

2019-07-09_useR-2019-rray

R
2
star
37

temporalintervals

What the Package Does (One Line, Title Case)
2
star
38

vsexample

What the Package Does (One Line, Title Case)
C++
2
star
39

xaringanrecipes-companion

JavaScript
2
star
40

2019-02-19_charlotte-dsba-5122

JavaScript
2
star
41

tidy64

An S3 Class Supporting 64-bit Integers
C
2
star
42

cexportuser

What the Package Does (One Line, Title Case)
C
2
star
43

xaringanrecipes

A Field Guide to xaringan
HTML
1
star
44

testpack

"Testing" an RStudio Project
R
1
star
45

datea

Extended Date Classes
R
1
star
46

cshared

Companion package for the blog post ->
C
1
star
47

R-Tutorials

JavaScript
1
star
48

cdemo

What the Package Does (One Line, Title Case)
C
1
star
49

int64

Large Integer Types
C
1
star
50

funneljoin-comparison

R
1
star
51

xtensorrr

An Easier Leap Into 'xtensor'
C++
1
star
52

featherframe

(DEPRECATED: reticulate does this now) Convert between R objects and Pandas DataFrames and Series, all within R
R
1
star
53

flatcat

Provide flat map()-ing functions
R
1
star
54

test-renv

R
1
star
55

almanac2

What the Package Does (One Line, Title Case)
R
1
star
56

almanac-old2

The Grammar of Schedules
R
1
star
57

blog

Personal website
JavaScript
1
star
58

testthathelperpath

What the Package Does (One Line, Title Case)
R
1
star
59

bookdownunder

bookdown in a package?
HTML
1
star
60

2023-04-24_code-review-principles

JavaScript
1
star
61

dockermachinery

What the Package Does (One Line, Title Case)
R
1
star