Package 'audit.base'

Title: Base package for Posit Checks
Description: Base package for sharing classes between posit audit packages. Unlikely to be useful as is.
Authors: Jumping Rivers [aut, cre]
Maintainer: Jumping Rivers <[email protected]>
License: file LICENSE
Version: 0.6.20
Built: 2025-02-21 18:32:09 UTC
Source: https://github.com/jumpingrivers/audit.base

Help Index


Audit Posit Server

Description

Used for side effect, i.e. printing to console

Usage

audit_posit_version(posit_version, type = c("connect", "workbench", "drivers"))

Arguments

posit_version

Current Posit version

type

Posit product of interest

Examples

audit_posit_version("2023.03.0", type = "connect")

Augments installed software columns

Description

Augments installed software columns

Usage

augment_installed(installed, verbose = TRUE)

print_colour_versions(installed)

Arguments

installed

A tibble with columns software and installed_version

verbose

Default TRUE.


Base Check Class

Description

Base Check Class

Base Check Class

Details

Inherited underlying base class. Shouldn't be used directly

Super class

audit.base::logger -> base_check

Public fields

group

Field for grouping tests

short

Use in config.yml

context

Human readable string

long

A long description of the test

account

Account name

Methods

Public methods

Inherited methods

Method new()

Set parameters for config file location

Usage
base_check$new(dir = ".", file = "config-uat.yml", debug_level = 0)
Arguments
dir

directory location of the the config file

file

config file name

debug_level

Value of 0, 1, or 2


Method info()

Summarise key class attributes

Usage
base_check$info()

Method clone()

The objects of this class are cloneable with this method.

Usage
base_check$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Check server headers

Description

In addition to the checks made by serverHeaders we also check that Posit isn't in one of the headers.

Usage

check_server_headers(server)

Arguments

server

URL of server


Checking System Dependencies

Description

Many R packages require additional system dependencies. This check, obtains a list of system libraries installed on the connect server, then determines which R packages can't be installed.

Usage

check_sys_deps(os_release, installed_libs, debug_level = 0:2)

Arguments

os_release

Output from /etc/os-release

installed_libs

A vector of packages, e.g. output apt list –installed, or 'get_installed_libs()'

debug_level

Integer - 0, 1, 2

Details

Suppress parameter will be changed in a near-future MR to verbose levels


Create test config

Description

This function creates an example config. By default all tests are TRUE. Some RSC servers intentionally won't have some features implemented.

Usage

create_config(file, pkg_name)

Arguments

file

Config file name

pkg_name

E.g. uat.base description

Details

If a test is missing from the config file, it is assume to be TRUE. Therefore, the config file can be quite short and just list exceptions. If the config file is missing, then all tests are carried out.

When merging configs, we either * merge the new with existing * force: overwrite existing file * error: if a config file exists, raise an error


Determines Installed Sys Libs

Description

Run on Posit workbench. Determines the system libs that are installed on a machine.

Usage

get_installed_libs()

clean_libs(os_release, libs)

Arguments

os_release

Output from /etc/os-release

libs

A vector of installed sys deps


Posit Versions

Description

Returns a tibble containing the Posit version, date of release, and any associated CVEs

Usage

get_posit_versions(type = c("connect", "workbench", "drivers"), remote = TRUE)

Arguments

type

Posit product of interest

remote

Try scrapping NEWS first, but fall back to local if that fails

Examples

get_posit_versions(type = "connect")

Quarto Helper Functions

Description

In general not used by users.

Usage

get_quarto_server_header(out)

get_quarto_sys_deps(out)

get_quarto_software_versions(out)

get_quarto_deploy(out)

get_quarto_posit_version_msg(out, type = c("connect", "workbench", "drivers"))

Arguments

out

Output from check

type

Posit product of interest


Debugging helper functions

Description

Debugging helper functions

Usage

get_suppress(debug_level)

get_debug_level(debug_level)

Arguments

debug_level

An integer, 0, 1, 2.


R6 Helper functions

Description

These functions are used by the health check function to initialise and check

Usage

init_r6_checks(dir, file, pkg_name)

init_r6_check(export, dir, file, pkg_name)

Arguments

dir

Directory of the config file

file

Config file name

pkg_name

E.g. uat.base description

export

Name of the R6 class to initialise


R6 logger class

Description

R6 logger class

R6 logger class

Details

Not called directly, but is inherited by base_check.

Methods

Public methods


Method start_logger()

Starts the logger

Usage
logger$start_logger()

Method stop_logger()

Stores the results of the check

Usage
logger$stop_logger(passed)
Arguments
passed

Logical, if skipped, the NA


Method get_log()

Retrieve the log

Usage
logger$get_log()
Returns

Check log


Method clone()

The objects of this class are cloneable with this method.

Usage
logger$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Helper functions for updating R/Py/Quarto/Posit versions

Description

Currently this function would only be called by the package author, as it updates inst/extdata/versions/*.csv

Usage

update_all_versions()