-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
48e9c33
commit d1bc1d5
Showing
28 changed files
with
213 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
^CONTRIBUTORS\.md$ | ||
^docs/ | ||
^\.idea | ||
^codecov\.yml$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#' Check Package Dependencies | ||
#' | ||
#' Collects R dependencies and checks them against OSS Index. | ||
#' Returns a tibble of results. | ||
#' | ||
#' This function is deprecated. See | ||
#' @details By default, packages listed in \code{installed.packages()} are scanned by sonatype. | ||
#' However, you can pass your own data frame of packages. This data frame should have two columns, | ||
#' \code{version} and \code{package}. | ||
#' @param pkgs Default \code{NULL}. See details for further information. | ||
#' @param verbose Default \code{TRUE}. | ||
#' @return A tibble/data.frame. | ||
#' @export | ||
audit_deps = function(pkgs = NULL, verbose = TRUE) { | ||
.Deprecated("audit_install_pkgs") | ||
if (is.null(pkgs)) | ||
audit_installed_r_pkgs(verbose = verbose) | ||
else | ||
audit(pkgs$package, version = pkgs$version, type = "cran", verbose = verbose) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,44 @@ | ||
#' Function to generate purls | ||
#' | ||
#' Generates purls from a vector of package names, version, and type. `version` and `type` | ||
#' must be the same length as `pkg` or else be of length one. | ||
#' Generates purls from a vector of package names, version, and type. `version` | ||
#' must be the same length as `pkg`. | ||
#' `type` must of the same length or else be of length one. | ||
#' | ||
#' @keywords internal | ||
gen_purls = function(pkg, version = "*", type = "cran") { | ||
|
||
generate_purls = function(pkg, version, type) { | ||
# Add in safety net | ||
if ((is.null(pkg) && is.null(version)) || | ||
(length(pkg) == 0L && length(version) == 0L)) return(list()) | ||
# Institute checks for both version and type. | ||
# type and version must be the same length as pkg or | ||
# of length 1. | ||
if ((length(type) > length(pkg)) && (length(type) != 1L)) { | ||
stop("`type` must be length 1 or same length as `pkg`.", call. = FALSE) | ||
if (length(pkg) != length(version)) { | ||
stop("pkgs must be the same length as version.", call. = FALSE) | ||
} | ||
if ((length(version) > length(pkg)) && (length(version) != 1L)) { | ||
stop("`version` must be length 1 or same length as `pkg`.", call. = FALSE) | ||
if ((length(type) != 1L) && (length(pkg) != length(type))) { | ||
stop("type must be 1 or the same length as pkgs", call. = FALSE) | ||
} | ||
|
||
# List format required for httr call | ||
# The list translates to the body of the curl call | ||
# Each purl must be it's own list element hence the use of as.list over list | ||
purls = as.list(paste0("pkg:", type, "/", pkg, "@", version)) | ||
return(purls) | ||
} | ||
|
||
|
||
#' Get data frame of installed packages | ||
#' | ||
#' @importFrom tibble as_tibble tibble | ||
#' @keywords internal | ||
get_pkgs = function(pkgs = NULL, verbose = TRUE) { | ||
if (!is.null(pkgs)) return(pkgs) | ||
|
||
get_r_pkgs = function(verbose = TRUE) { | ||
if (isTRUE(verbose)) { | ||
cli::cli_alert_info("Calling {.pkg installed.packages()}, this may take time") | ||
} | ||
pkgs = tibble::as_tibble(installed.packages()[, c(1, 3:4)]) | ||
|
||
# ensuring all packages are included including base and recommended | ||
pkgs = pkgs[, c("Package", "Version")] | ||
pkgs = tibble::as_tibble(installed.packages()[, c(1, 3)]) | ||
# XXX: Remove line when audit_dep is removed | ||
colnames(pkgs) = c("package", "version") | ||
return(pkgs) | ||
} | ||
|
||
#' Create a list of purls based on installed packages | ||
#' | ||
#' @importFrom utils installed.packages | ||
#' @keywords internal | ||
get_purls = function(pkgs) { | ||
if (nrow(pkgs) == 0) return(list()) | ||
|
||
# Extract Package and Version columns | ||
purls = gen_purls(pkg = pkgs$package, version = pkgs$version, type = "cran") | ||
return(purls) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
comment: false | ||
|
||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
informational: true | ||
patch: | ||
default: | ||
target: auto | ||
threshold: 1% | ||
informational: true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.