Skip to content
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

usethis::use_lifecycle() creates R CMD check note #896

Closed
florianm opened this issue Sep 23, 2019 · 0 comments
Closed

usethis::use_lifecycle() creates R CMD check note #896

florianm opened this issue Sep 23, 2019 · 0 comments
Labels
bug an unexpected problem or unintended behavior docs 💡 documentation, news, vignettes, website, etc

Comments

@florianm
Copy link

Problem

First reported at r-lib/lifecycle#22

usethis::use_lifecycle() allows to use \lifecycle{...} in function docs. If lifecycle is not referenced anywhere else in the package, R CMD check will raise a NOTE.

# develop a package
usethis::use_lifecycle()
# add \lifecycle{...} to some function docs
goodpractice::goodpractice() # raises R CMD check NOTE on unused library `lifecycle`:

N  checking dependencies in R code (401ms)
   Namespace in Imports field not imported from:lifecycleAll declared Imports should be used.

@lionel- suggested to include a NOOP anywhere in the code:

if (FALSE) lifecycle::deprecate_soft()

This expression can live in a stand-alone file like R/utils-lifecycle.R.
To preserve test coverage, depending on the coverage tool used, this file should be excluded. For codecov.io, this could look like this. Thinking out loud: it is fine to exclude from tests, as the expression will never run.

As a feature request to usethis::use_lifecycle(), could I suggest to

  • generate a file containing a NOOP like if (FALSE) lifecycle::deprecate_soft(), and
  • exclude that file from whichever test coverage tool is used (or at least message to do so).
@hadley hadley added bug an unexpected problem or unintended behavior docs 💡 documentation, news, vignettes, website, etc labels Oct 16, 2019
@hadley hadley closed this as completed in eaa1144 Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior docs 💡 documentation, news, vignettes, website, etc
Projects
None yet
Development

No branches or pull requests

2 participants