Skip to content

Commit

Permalink
Take out checksum from IQ.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbosak01 committed Sep 6, 2023
1 parent b129904 commit 2a7f03e
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 295 deletions.
79 changes: 41 additions & 38 deletions R/iq.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,36 @@

# Installation Qualification ----------------------------------------------

# Pull this out for now.
# @details
# The \code{run_iq} function works by comparing package checksums and file
# sizes against expected values.
#
# The function first tries to determine the
# installation location of each package. If the installation location cannot
# be found, the check for that package will fail. If the installation
# location is found, the function will open the package and capture a
# checksum and file size on the code repository. The checksum and file
# sizes are then compared against known values. Ideally, the checksum
# value will match. If not, the function will compare the file sizes. If
# both the checksum and file size comparison fail, the check for that package
# will fail. If one of them passes, the check will pass.
#
# Note that the checksum values are somewhat volatile, and can change
# from one Operating System to the next. The checksum can also change
# if the R version is upgraded. Therefore, the checksum is not a perfectly
# reliable indicator of authenticity. It is for that reason that the
# file size is used as a backup indicator.



#' @title Generates an Installation Qualification Report
#' @description The \code{run_iq} function executes an
#' installation qualification (IQ)
#' on the currently installed \strong{sassy} packages, and generates a report
#' on the results. The IQ ensures that the files in the \strong{sassy} packages
#' are correct, and have not been altered.
#' on the results. The IQ ensures that all \strong{sassy} packages
#' have been installed.
#' The results of the IQ will be placed in the supplied location.
#' @details
#' The \code{run_iq} function works by comparing package checksums and file
#' sizes against expected values.
#'
#' The function first tries to determine the
#' installation location of each package. If the installation location cannot
#' be found, the check for that package will fail. If the installation
#' location is found, the function will open the package and capture a
#' checksum and file size on the code repository. The checksum and file
#' sizes are then compared against known values. Ideally, the checksum
#' value will match. If not, the function will compare the file sizes. If
#' both the checksum and file size comparison fail, the check for that package
#' will fail. If one of them passes, the check will pass.
#'
#' Note that the checksum values are somewhat volatile, and can change
#' from one Operating System to the next. The checksum can also change
#' if the R version is upgraded. Therefore, the checksum is not a perfectly
#' reliable indicator of authenticity. It is for that reason that the
#' file size is used as a backup indicator.
#'
#' @param location The path to the desired output directory. The IQ
#' reports and any associated files will be placed in this directory.
#' @return The path to the output directory. The directory
Expand Down Expand Up @@ -81,22 +82,24 @@ run_iq <- function(location) {

if (all(ret$Pass == TRUE)) {

sep("Package File Examination")

sep("Examine common package")
ret <- rbind(ret, examine_package("common"))

sep("Examine fmtr package")
ret <- rbind(ret, examine_package("fmtr"))

sep("Examine libr package")
ret <- rbind(ret, examine_package("libr"))

sep("Examine reporter package")
ret <- rbind(ret, examine_package("reporter"))

sep("Examine procs package")
ret <- rbind(ret, examine_package("procs"))
# Commenting out for now. Can't pass GITHUB checks and will
# not pass CRAN checks.
# sep("Package File Examination")
#
# sep("Examine common package")
# ret <- rbind(ret, examine_package("common"))
#
# sep("Examine fmtr package")
# ret <- rbind(ret, examine_package("fmtr"))
#
# sep("Examine libr package")
# ret <- rbind(ret, examine_package("libr"))
#
# sep("Examine reporter package")
# ret <- rbind(ret, examine_package("reporter"))
#
# sep("Examine procs package")
# ret <- rbind(ret, examine_package("procs"))

} else {

Expand Down
20 changes: 10 additions & 10 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ print_report <- function(path, dat, ttls) {
tbl <- create_table(datm, header_bold = TRUE)

rpt <- create_report(path, output_type = "PDF", font = "Arial",
orientation = "landscape") |>
titles(ttls, bold = TRUE, font_size = 12, blank_row = "none") |>
titles("Date: " %p% fapply(Sys.time(), "%Y-%m-%d %H:%M:%S %p")) |>
add_content(tbl)
orientation = "landscape")
rpt <- titles(rpt, ttls, bold = TRUE, font_size = 12, blank_row = "none")
rpt <- titles(rpt, "Date: " %p% fapply(Sys.time(), "%Y-%m-%d %H:%M:%S %p"))
rpt <- add_content(rpt, tbl)

res <- write_report(rpt)

Expand All @@ -47,15 +47,15 @@ view_report <- function(dat, ttls) {

datm <- data.frame(ID = seq(1, nrow(dat)), dat)

tbl <- create_table(datm, header_bold = TRUE) |>
titles(ttls, bold = TRUE, font_size = 12, blank_row = "none") |>
titles("Date: " %p% fapply(Sys.time(), "%Y-%m-%d %H:%M:%S %p"))
tbl <- create_table(datm, header_bold = TRUE)
tbl <- titles(tbl, ttls, bold = TRUE, font_size = 12, blank_row = "none")
tbl <- titles(tbl, "Date: " %p% fapply(Sys.time(), "%Y-%m-%d %H:%M:%S %p"))

rpt <- create_report(path, output_type = "HTML", font = "Arial",
paper_size = "none",
orientation = "portrait") |>
set_margins(top = .5, bottom = .5, left = .5, right = .5) |>
add_content(tbl)
orientation = "portrait")
rpt <- set_margins(rpt, top = .5, bottom = .5, left = .5, right = .5)
rpt <- add_content(rpt, tbl)

res <- write_report(rpt)

Expand Down
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ articles:
sassy-survival: sassy-survival.html
sassy-vs: sassy-vs.html
sassy: sassy.html
last_built: 2023-09-06T15:28Z
last_built: 2023-09-06T16:10Z
urls:
reference: https://sassy.r-sassy.org/reference
article: https://sassy.r-sassy.org/articles
Expand Down
27 changes: 4 additions & 23 deletions docs/reference/run_iq.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 2 additions & 22 deletions man/run_iq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2a7f03e

Please sign in to comment.