R/utils.R

Defines functions is_rmd_file find_perl setNames

# nolint start

setNames <- function(object = nm, nm)  {
  names(object) <- nm
  object
}

is_url <- function (path) { grepl("^(git|http|ftp)s?://", path) }

find_perl <- function() {

  perl <- Sys.which("perl")

  if (perl == "") {
    stop(
      "Cannot find 'perl'. cloc requires perl to be installed and on the PATH.",
      call. = FALSE
    )
  }

  return(perl)

}

is_rmd_file <- function(path) { grepl("\\.Rmd$", path, ignore.case = TRUE) }

# nolint end
hrbrmstr/cloc documentation built on May 1, 2023, 7:34 a.m.