Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for externally scored packages #70

Merged
merged 31 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8e4e3d9
DESCRIPTION: bump roxygen2 version
kyleam Aug 6, 2024
eeaa1b9
test-format-report.R: simplify an assertion
kyleam Aug 6, 2024
bd85be5
scorecard-template.Rmd: fix default parameter values
kyleam Aug 6, 2024
01ad5f7
render: allow omitting the dependency table
kyleam Aug 6, 2024
606fb49
render: don't assume coverage values are already rounded
kyleam Aug 6, 2024
7d809f6
format_traceability_matrix: don't require test_dirs column
kyleam Aug 6, 2024
b6527fc
aaa.R: assign *.scorecard.json keys to a variable
kyleam Aug 6, 2024
65b029f
score_pkg: rename 'covr' metric to 'coverage'
kyleam Aug 6, 2024
4602372
format_appendix: rename 'R Script' column to 'Code File'
kyleam Aug 6, 2024
8022da5
create_extra_notes: rename covr_results_df to cov_results_df
kyleam Aug 6, 2024
af60b6d
format_appendix: rename variables to replace "covr" with "cov"
kyleam Aug 6, 2024
599394f
map_answer: make including check score optional
kyleam Aug 6, 2024
693d1c5
format_traceability_matrix: avoid formula for purrr function
kyleam Aug 6, 2024
dcd2ee2
format_traceability_matrix: avoid range for column selection
kyleam Aug 6, 2024
91f88b8
format_metadata: don't error if sys or env_vars is missing
kyleam Aug 6, 2024
f81aa48
score_pkg: record scorecard_type
kyleam Aug 6, 2024
6623618
score_pkg: add mpn_scorecard_format key to *.scorecard.json
kyleam Aug 6, 2024
7f3fe88
render_scorecard: fix a checkmate assertion
kyleam Aug 6, 2024
7371fdd
render_scorecard: drop note about traceability matrix file
kyleam Aug 6, 2024
aa2cb8f
render_scorecard: move preparation of params to dedicated function
kyleam Aug 6, 2024
66e0b02
get_result_path: add extensions for externally scored packages
kyleam Aug 6, 2024
3f0a2f1
render_scorecard: support externally scored packages
kyleam Aug 6, 2024
2d5c2ec
external: make coverage optional
kyleam Aug 6, 2024
fb70eeb
external: add some basic validation of inputs
kyleam Aug 6, 2024
00231b9
format_appendix: wrap file column in coverage table
kyleam Aug 6, 2024
24bdf6a
test-format-report.R: trigger covr failure case
kyleam Aug 10, 2024
e17a7c9
format_appendix: replace empty coverage table with note
kyleam Aug 10, 2024
cc0b696
format_traceability_matrix: wrap test files at default characters
kyleam Aug 12, 2024
bc4ab1a
summary: guard against external scores
kyleam Aug 8, 2024
43d391e
readme: add short section on external scores
kyleam Aug 8, 2024
9094594
format_appendix: decrease width for file in coverage table
kyleam Aug 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ Imports:
stringr,
tibble,
tidyselect,
tidyr
tidyr,
yaml
Suggests:
devtools,
pdftools,
roxygen2,
testthat (>= 2.1.0),
withr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ importFrom(rlang,abort)
importFrom(rlang,inform)
importFrom(rlang,sym)
importFrom(rlang,warn)
importFrom(tidyselect,all_of)
importFrom(tidyselect,everything)
21 changes: 19 additions & 2 deletions R/aaa.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#' @importFrom tidyselect everything
#' @importFrom tidyselect everything all_of
NULL


Expand All @@ -12,8 +12,25 @@ RISK_LEVELS <- c("NA - unexpected", "High Risk", "Medium Risk", "Low Risk")

utils::globalVariables(c("."))

METRIC_CATEGORIES <- c("testing", "documentation", "maintenance", "transparency")

DOCUMENTATION_METRICS <- c("has_vignettes", "has_website", "has_news") #, export_help)
MAINTENANCE_METRICS <- c("has_maintainer", "news_current")#, "last_30_bugs_status")
TRANSPARENCY_METRICS <- c("has_source_control", "has_bug_reports_url")
TESTING_METRICS <- c("check", "covr")
TESTING_METRICS <- c("check", "coverage")

MPN_SCORECARD_FORMAT <- "1.0"

SCORECARD_JSON_KEYS <- c(
"mpn_scorecard_format",
"mpn_scorecard_version",
"pkg_name",
"pkg_version",
"scorecard_type",
"out_dir",
"pkg_tar_path",
"md5sum_check",
"scores",
"metadata",
"category_scores"
)
4 changes: 2 additions & 2 deletions R/calc-overall-scores.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ calc_overall_scores <- function(scorelist) {
scorelist$category_scores <- purrr::map(categories, ~{
indiv_scores <- unlist(scorelist$scores[[.x]])
# Penalize coverage failures: NA --> 0
if("covr" %in% names(indiv_scores) && is.na(indiv_scores[["covr"]])){
indiv_scores[["covr"]] <- 0
if ("coverage" %in% names(indiv_scores) && is.na(indiv_scores[["coverage"]])) {
indiv_scores[["coverage"]] <- 0
}
round(mean(indiv_scores), 3)
}) %>% purrr::set_names(categories)
Expand Down
10 changes: 5 additions & 5 deletions R/create-extra-notes.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ create_extra_notes <- function(
covr_results <- readRDS(covr_path)
if (inherits(covr_results$errors, "error")) {
covr_results_df <- data.frame(
r_script = "File coverage failed",
code_file = "File coverage failed",
test_coverage = conditionMessage(covr_results$errors)
)
} else if (length(covr_results$coverage$filecoverage)) {
covr_results_df <- covr_results$coverage$filecoverage %>% as.data.frame()
covr_results_df <- covr_results_df %>%
mutate(r_script = row.names(covr_results_df)) %>%
dplyr::select("r_script", "test_coverage" = ".")
mutate(code_file = row.names(covr_results_df)) %>%
dplyr::select("code_file", "test_coverage" = ".")
row.names(covr_results_df) <- NULL
} else {
covr_results_df <- data.frame(
r_script = "No coverage results",
code_file = "No coverage results",
test_coverage = covr_results$notes
)
}

return(
list(
covr_results_df = covr_results_df,
cov_results_df = covr_results_df,
check_output = check_results$stdout
)
)
Expand Down
Loading