assert_ref: Display error if not a valid reference

Description Usage Arguments Details Value

View source: R/utilities.R

Description

A valid reference has restrictions on the special characters allowed (see details).

Usage

1
2
3
4
5
6
7
assert_ref(
  x,
  level = 1,
  msg_level = getOption("msgr.level"),
  msg_types = getOption("msgr.types"),
  log_path = getOption("msgr.log_path")
)

Arguments

x

(any) The object to test.

level

(integer, optional) The level of the message, from 1 to 10. Default: 1.

msg_level

(integer, optional) The maximum level of messages to output. Default: set in the option "msgr.level".

msg_types

(character, optional) The type to write or display. Must either NULL or one or more from "INFO", "WARNING" or "ERROR". Default: set in the option "msgr.types".

log_path

(character, optional) The file path to the text log file. If set to "", then no logs are written. Default: set in the option "msgr.log_path".

Details

Git imposes the following rules when naming references:

  1. They can include slash / for hierarchical (directory) grouping, but no slash-separated component can begin with a dot . or dash - or end with the sequence .lock.

  2. They cannot have two consecutive dots .. anywhere.

  3. They cannot have the special characters: space , tilde ~, caret ^, or colon :, question-mark ?, asterisk *, backslash \\, or open bracket \[ anywhere.

  4. They cannot begin or end with a slash / or contain multiple consecutive slashes

  5. They cannot end with a dot ..

  6. They cannot contain a sequence @\{.

  7. They cannot be the single character @.

Value

If assertion passes then TRUE is returned. This allows you to make multiple assertions separated by &.


ChadGoymer/githapi documentation built on Oct. 22, 2021, 10:56 a.m.