Title: 'Roxygen2' Global Variable Declarations
Version: 1.0.0
Description: Generate utils::globalVariables() from 'roxygen2' @global and @autoglobal tags.
License: MIT + file LICENSE
URL: https://github.com/anthonynorth/roxyglobals
BugReports: https://github.com/anthonynorth/roxyglobals/issues
Imports: brio, codetools, desc, roxygen2
Suggests: covr, testthat (≥ 3.0.0), withr
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2023-08-21 10:41:36 UTC; anthony
Author: Anthony North [aut, cre, cph], Miles McBain ORCID iD [ctb]
Maintainer: Anthony North <anthony.jl.north@gmail.com>
Repository: CRAN
Date/Publication: 2023-08-21 14:20:08 UTC

roxyglobals: 'Roxygen2' Global Variable Declarations

Description

Generate utils::globalVariables() from 'roxygen2' @global and @autoglobal tags.

Author(s)

Maintainer: Anthony North anthony.jl.north@gmail.com [copyright holder]

Other contributors:

See Also

Useful links:


Roclet: global

Description

This roclet automates utils::globalVariables() declaration from @global and @autoglobal roxygen tags.

Package authors will not typically need to invoke global_roclet() directly. Global roclet instances are created by roxygen2 during roxygen2::roxygenise() (or devtools::document()).

Usage

global_roclet()

Value

A roxygen2::roclet() instance for declaring utils::globalVariables() during roxygen2::roxygenise()

Examples

#' @autoglobal
foo <- function(x) {
  # bar isn't declared -> add to utils::globalVariables()
  subset(x, bar == 4)
}

#' @global bar
foo <- function(x) {
  # bar is explicitly defined as a global -> add to utils::globalVariables()
  subset(x, bar == 4)
}

Roxyglobals options

Description

Get and set roxyglobals options in DESCRIPTION file.

Usage

options_get_unique(file = ".")

options_set_unique(value, file = ".")

options_get_filename(file = ".")

options_set_filename(value, file = ".")

Arguments

file

DESCRIPTION file to use. By default the DESCRIPTION file of the current package (i.e. the package the working directory is part of) is used.

value

The new option value

Value

The option value or nothing

Functions

Examples

options_get_unique()
## Not run: 
options_set_unique(TRUE)

## End(Not run)
options_get_filename()
## Not run: 
options_set_filename("roxyglobals-generated.R")

## End(Not run)

Use roxyglobals

Description

Configures roxygen to use global_roclet(), adds roxyglobals to Suggests

Usage

use_roxyglobals()

Value

nothing

Examples

## Not run: 
use_roxyglobals()

## End(Not run)