Skip to content

Commit 684454d

Browse files
authored
Merge pull request #42 from pharmaR/increase_back_compatibility
Make it more compatible with older packages
2 parents b538187 + 1caf53e commit 684454d

File tree

9 files changed

+4384
-9
lines changed

9 files changed

+4384
-9
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ License: MIT + file LICENSE
1212
URL: https://github.com/pharmaR/riskreports, https://pharmar.github.io/riskreports/
1313
BugReports: https://github.com/pharmaR/riskreports/issues
1414
Depends:
15-
R (>= 4.5.0)
15+
R (>= 4.3.0)
1616
Imports:
1717
methods,
1818
htmltools,
@@ -31,4 +31,4 @@ Config/testthat/edition: 3
3131
Encoding: UTF-8
3232
Language: en-US
3333
Roxygen: list(markdown = TRUE)
34-
RoxygenNote: 7.3.2
34+
RoxygenNote: 7.3.3

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export(summary_table)
1010
importFrom(htmltools,div)
1111
importFrom(methods,is)
1212
importFrom(tools,check_packages_in_dir_details)
13+
importFrom(utils,getFromNamespace)

R/render_utils.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55
#' @details The function analyzes if the license is standard. If it is standard, then it will see if there is available
66
#' information for the footer. The footer information is only the multiple version number for the moment.
77
#' @keywords internal
8+
#' @importFrom utils getFromNamespace
89
extract_license <- function(assessment) {
910
license_output <- list(main = as.character(assessment$license))
10-
11-
license_analysis <- tools::analyze_license(license_output$main)
11+
# We use the internal version so that we can use old R versions analyze_license
12+
if (getRversion() < "4.4.0") {
13+
analyze_license <- utils::getFromNamespace("tools", "analyze_license") # nolint
14+
} else {
15+
analyze_license <- tools::analyze_license
16+
}
17+
license_analysis <- analyze_license(license_output$main)
1218

1319
if (isTRUE(license_analysis$is_standardizable)) {
1420
license_output$main <- sub("\\(.+\\)", "", license_analysis$components[1])

R/utils.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ fill_in <- function(list, names) {
1818
list
1919
}
2020

21+
`%||%` <- function (x, y) {
22+
if (is.null(x)) y else x
23+
}
2124

2225
output_dir <- function() {
2326
opt <- getOption("riskreports_output_dir", default = NULL)
@@ -37,8 +40,13 @@ is_empty <- function(x) {
3740
is.null(x) || is.na(x) || !nzchar(x)
3841
}
3942

43+
44+
is.empty <- function(x) {
45+
is.null(x) || is.na(x) || !nzchar(x)
46+
}
47+
4048
#' Return string to display Origin depending on source of the assessment
41-
#'
49+
#'
4250
#' @param source return value of function `pkg_ref`
4351
#' @returns depending on source transformed string for the origin
4452
#' @keywords internal

man/assessment.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/is_risk_error.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/replace_zero_or_false_by_no.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/summary_table.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkgdown/assets/validation_report_dplyr_v1.1.4.html

Lines changed: 4360 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)