Skip to contents

Create the message for the colons_check() function.

Usage

.colons_check_message(
  list_fun,
  list_fun_pos,
  line_nb,
  ini,
  arg_user_setting2,
  text,
  internal_fun_names,
  lib_path,
  error_text
)

Arguments

list_fun

List of names of all the functions.

list_fun_pos

List of positions of first character of names of all the functions in ini.

line_nb

Vector of integers of corresponding line numbers.

ini

Vector of strings of the initial function code analyzed.

arg_user_setting2

List of arg user settings.

text

Either "BASIC" or "OTHER".

internal_fun_names

Vector of strings of names of internal functions in the function code analyzed. Can be NULL.

lib_path

Vector of characters specifying the absolute pathways of the directories containing the required packages for the function, if not in the default directories. Useful when R packages are not installed in the default directories because of lack of admin rights. More precisely, lib_path is passed through the new argument of .libPaths() so that the new library paths are unique(c(new, .Library.site, .Library)). Warning: .libPaths() is restored to the initial paths, after function execution. Ignored if NULL (default) or if the safer_check argument is FALSE: only the pathways specified by the current .libPaths() are used for package calling.

error_text

Single character string used to add information in error messages returned by the function, notably if the function is inside other functions, which is practical for debugging. Example: error_text = " INSIDE <PACKAGE_1>::<FUNCTION_1> INSIDE <PACKAGE_2>::<FUNCTION_2>.". If NULL, converted into "".

Value

A list:

  • output.cat: the message (string).

  • colon_not_here: logical vector. Does list_fun contain function names without :: or ::: ?

Details

Warnings:

  • requires saferDev::arg_check, saferDev:::.noclean_functions.

  • In main safer functions, in the section "######## check of the required functions from the required packages", add also these 2 functions when checking for the presence of saferDev:::.colons_check_message.

Examples

if (FALSE) {
# Example that shouldn't be run because this is an internal function (not found by devtools::check())
saferDev:::.colons_check_message(list_fun = list(c2 = "UseMethod"), 
list_fun_pos = list(c2 = 1), line_nb = 2, 
ini = c("function (x, ...) ", "UseMethod(\"mean\")"), 
arg_user_setting2 = list(x = "mean"), text = "BASIC", 
internal_fun_names = NULL, lib_path = NULL, 
error_text = " INSIDE P1::F1")
}