Find missing 'return' tag when function exported
find_missing_tags(
package.dir = ".",
roclets = NULL,
load_code = NULL,
clean = FALSE
)Location of package top level directory. Default is working directory.
Character vector of roclet names to use with package.
The default, NULL, uses the roxygen roclets option,
which defaults to c("collate", "namespace", "rd").
A function used to load all the R code in the package
directory. The default, NULL, uses the strategy defined by
the load roxygen option, which defaults to load_pkgload().
See load for more details.
If TRUE, roxygen will delete all files previously
created by roxygen before running each roclet.
a list with the 3 data.frames with the missing tags
if (FALSE) {
# What you will do from inside your package
find_missing_tags()
}
# A reproducible example on a test package
pkg_path <- create_example_pkg()
#> ✔ Creating '/tmp/RtmpFU8HyQ/pkg-189921c8a033/checkpackage/'
#> ✔ Setting active project to '/tmp/RtmpFU8HyQ/pkg-189921c8a033/checkpackage'
#> ✔ Creating 'R/'
#> ✔ Writing 'DESCRIPTION'
#> Package: checkpackage
#> Title: What the Package Does (One Line, Title Case)
#> Version: 0.0.0.9000
#> Authors@R (parsed):
#> * First Last <first.last@example.com> [aut, cre] (YOUR-ORCID-ID)
#> Description: What the package does (one paragraph).
#> License: `use_mit_license()`, `use_gpl3_license()` or friends to
#> pick a license
#> Encoding: UTF-8
#> Roxygen: list(markdown = TRUE)
#> RoxygenNote: 7.3.0
#> ✔ Writing 'NAMESPACE'
#> ✔ Setting active project to '<no active project>'
#> Saving attachment parameters to yaml config file
#> Updating checkpackage documentation
#> Writing NAMESPACE
#> ℹ Loading checkpackage
#> ✖ function.R:4: @return requires a value.
#> Writing NAMESPACE
#> Writing my_long_fun_name_for_multiple_lines_globals.Rd
#> Writing my_plot.Rd
#> Writing my_not_exported_doc.Rd
#> ℹ Loading checkpackage
#> [+] 1 package(s) added: dplyr.
find_missing_tags(pkg_path)
#> ℹ Loading checkpackage
#> ✖ function.R:4: @return requires a value.
#> Problem: Missing or empty return value for exported functions: my_long_fun_name_for_multiple_lines_globals
#>
#> Problem: Doc available but need to choose between `@export` or `@noRd`: my_not_exported_doc
#>
#> ℹ Loading checkpackage
#> ✖ function.R:4: @return requires a value.
#> $package_doc
#> # A tibble: 0 × 0
#>
#> $data
#> # A tibble: 0 × 0
#>
#> $functions
#> # A tibble: 5 × 11
#> id filename topic has_export has_return return_value has_nord rdname_value
#> <int> <chr> <chr> <lgl> <lgl> <chr> <lgl> <chr>
#> 1 1 function… my_l… TRUE FALSE "" FALSE my_long_fun…
#> 2 2 function… my_p… TRUE TRUE "GGplot for… FALSE my_plot
#> 3 3 function… my_n… FALSE FALSE "" FALSE my_not_expo…
#> 4 4 function… my_n… FALSE FALSE "" TRUE my_not_expo…
#> 5 5 function… my_p… TRUE TRUE "GGplot for… FALSE my_plot
#> # ℹ 3 more variables: not_empty_return_value <lgl>,
#> # test_has_export_and_return <chr>, test_has_export_or_has_nord <chr>
#>