Skip to contents

Convert a package codebase into applicable roxytypes tags. For roxygen2 tags with drop-in replacements (namely @param and @return tags), process descriptions and replace tags with roxytypes equivalents.

Usage

convert(
  path = ".",
  format = config(path, refresh = TRUE, cache = FALSE)$format,
  ...,
  unmatched = FALSE,
  verbose = interactive()
)

Arguments

path

(character[1]) A file path within your package. Defaults to the current working directory.

format

(character[1]) A glue-style format to use to parse types and descriptions for conversion to roxytypes tags. Available glue keywords include type and description. By default, type will match any string until a closing backtick and description will match any string. See details for more information.

...

Additional arguments passed to build_format_regex().

unmatched

(logical[1]) Indicates whether tags that fail to match should still be converted into roxytypes tags. Such conversions may be convenient if you aim to convert your package holistically, as it will help to flag undocumented parameter types the next time you re-build your documentation.

verbose

(logical[1]) Indicates whether command-line interface should be emitted so that changes can be reviewed interactively.

Value

(logical[1]) TRUE if successfully completes, FALSE if aborted. Always returns invisibly.

Details

A format string is built using build_format_regex(), which accepts parameters type and description, which describe how to match these components of a parameter definition. They are combined with the literal content of format to produce a regular expression to split existing definitions.

For comprehensive control, pass format_re directly, bypassing expression construction altogether.

Examples

if (FALSE) { # \dontrun{
convert("(`{type}`) {description}")
} # }