Skip to contents

To see the results, just print it to the screen.

Usage

gp(
  path = ".",
  checks = NULL,
  extra_preps = NULL,
  extra_checks = NULL,
  quiet = TRUE
)

Arguments

path

Path to a package root.

checks

Character vector, the checks to run. When NULL (the default), all registered checks are run, subject to any exclusions from goodpractice.exclude_preps or GP_EXCLUDE_PREPS. Explicitly passing check names overrides any exclusion settings. Use all_checks to list available checks.

extra_preps

Custom preparation functions. See make_prep on creating preparation functions.

extra_checks

Custom checks. See make_check on creating checks.

quiet

Whether to suppress output from the preparation functions. Note that not all preparation functions produce output, even if this option is set to FALSE.

Value

A goodpractice object that you can query with a simple API. See results to start.

Excluding check groups

When using the default checks = all_checks(), entire groups of checks can be excluded by prep name via the goodpractice.exclude_preps option or the GP_EXCLUDE_PREPS environment variable (comma-separated). The option takes precedence.


# Skip URL and coverage checks:
options(goodpractice.exclude_preps = c("urlchecker", "covr"))

# Or via environment variable:
Sys.setenv(GP_EXCLUDE_PREPS = "urlchecker,covr")

Exclusion only applies when checks = NULL (the default). Explicit checks arguments are never filtered.

Examples

path <- system.file("bad1", package = "goodpractice")
# run a subset of all checks available
g <- gp(path, checks = all_checks()[3:16])
#>  Preparing: description
#>  Preparing: description [10ms]
#> 
#>  Preparing: lintr
#>  Preparing: lintr [57ms]
#> 
g
#> ── GP badpackage ───────────────────────────────────────────────────────────────
#> 
#> It is good practice to
#> 
#>    not use "Depends" in DESCRIPTION, as it can cause name clashes, and poor
#>     interaction with other packages. Use "Imports" instead.
#>    omit "Date" in DESCRIPTION. It is not required and it gets invalid quite
#>     often. A build date will be added to the package when you perform `R CMD
#>     build` on it.
#>    add a "URL" field to DESCRIPTION. It helps users find information about
#>     your package online. If your package does not have a homepage, add an URL
#>     to GitHub, or the CRAN package package page.
#>    add a "BugReports" field to DESCRIPTION, and point it to a bug tracker.
#>     Many online code hosting services provide bug trackers for free,
#>     https://github.com, https://gitlab.com, etc.
#>    omit trailing semicolons from code lines. They are not needed and most R
#>     coding standards forbid them
#> 
#>     R/semicolons.R:4:30
#>     R/semicolons.R:5:29
#>     R/semicolons.R:9:38
#> 
#> ────────────────────────────────────────────────────────────────────────────────