Skip to contents

Check for usage of unavailable functions. Not reliable for testing r-devel dependencies.

Usage

backport_linter(r_version = getRversion(), except = character())

Arguments

r_version

Minimum R version to test for compatibility

except

Character vector of functions to be excluded from linting. Use this to list explicitly defined backports, e.g. those imported from the {backports} package or manually defined in your package.

See also

linters for a complete list of linters available in lintr.

Examples

# will produce lints
lint(
  text = "trimws(x)",
  linters = backport_linter("3.0.0")
)
#> ::warning file=<text>,line=1,col=1::file=<text>,line=1,col=1,[backport_linter] trimws (R 3.2.0) is not available for dependency R >= 3.0.0. Use the `except` argument of `backport_linter()` to configure available backports.

lint(
  text = "str2lang(x)",
  linters = backport_linter("3.2.0")
)
#> ::warning file=<text>,line=1,col=1::file=<text>,line=1,col=1,[backport_linter] str2lang (R 3.6.0) is not available for dependency R >= 3.2.0. Use the `except` argument of `backport_linter()` to configure available backports.

# okay
lint(
  text = "trimws(x)",
  linters = backport_linter("3.6.0")
)

lint(
  text = "str2lang(x)",
  linters = backport_linter("4.0.0")
)