From cfc4da0fd076d3587b19d19c0786d8a15cae0360 Mon Sep 17 00:00:00 2001 From: Alex Axthelm Date: Tue, 9 Apr 2024 17:37:09 +0200 Subject: [PATCH] linting --- .lintr | 1 + R/dependencies.R | 8 +++++--- R/get_gh_file.R | 4 ++-- R/utils.R | 4 ++-- R/workflows.R | 9 +++++---- inst/extdata/github-repos.Rmd | 9 ++++++--- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.lintr b/.lintr index 9ae5123..90bd541 100644 --- a/.lintr +++ b/.lintr @@ -1,6 +1,7 @@ linters: all_linters() exclusions: list( "tests/testthat.R", + "tests/testthat/test-generate_package_table.R", "R/generate_package_table.R", "R/repo_lists.R" = c( nonportable_path_linter = Inf diff --git a/R/dependencies.R b/R/dependencies.R index 798c094..d0191a7 100644 --- a/R/dependencies.R +++ b/R/dependencies.R @@ -1,6 +1,8 @@ identify_gh_deps <- function(repo_fullname) { deps <- tryCatch( - expr = {pak::pkg_deps(repo_fullname)}, + expr = { + pak::pkg_deps(repo_fullname) + }, error = function(e) { NULL } @@ -38,8 +40,8 @@ identify_if_dep <- function( for (i in seq_along(dep_lists)) { if ( repo_fullname %in% dep_lists[[i]] || - repo_fullname %in% repos_to_check[[i]] - ) { + repo_fullname %in% repos_to_check[[i]] + ) { dep_levels <- c(names(dep_lists)[i], dep_levels) } } diff --git a/R/get_gh_file.R b/R/get_gh_file.R index 35c308f..a8028c0 100644 --- a/R/get_gh_file.R +++ b/R/get_gh_file.R @@ -51,8 +51,8 @@ get_gh_dir_listing <- function(repo_fullname, dir_path) { response, function(x) { list( - name = x[["name"]], - path = x[["path"]] + name = x[["name"]], + path = x[["path"]] ) } ) diff --git a/R/utils.R b/R/utils.R index 40aef98..ef30df9 100644 --- a/R/utils.R +++ b/R/utils.R @@ -4,8 +4,8 @@ list_is_subset <- function(x, y) { all(vapply(x, function(x_elem) { any(vapply(y, function(y_elem) { list_is_subset(x_elem, y_elem) - }, logical(1))) - }, logical(1))) + }, logical(1L))) + }, logical(1L))) } else { identical(x, y) } diff --git a/R/workflows.R b/R/workflows.R index 4dc1cb8..0afb512 100644 --- a/R/workflows.R +++ b/R/workflows.R @@ -76,7 +76,7 @@ workflow_summary <- function( if ( !("push" %in% names(workflows[[wf]][["triggers"]])) || is.null(workflows[[wf]][["triggers"]][["push"]]) - ) { + ) { checks_main <- FALSE } else { checks_main <- "main" %in% workflows[[wf]][["triggers"]][["push"]] @@ -102,9 +102,10 @@ workflow_summary <- function( ) } workflow_summary[["all_standard"]] <- all( - sapply( - workflow_summary, - function(x) x[["standard"]] + vapply( + X = workflow_summary, + FUN = function(x) x[["standard"]], + FUN.VALUE = logical(1L) ) ) return(workflow_summary) diff --git a/inst/extdata/github-repos.Rmd b/inst/extdata/github-repos.Rmd index 21ee8cd..3a22d28 100644 --- a/inst/extdata/github-repos.Rmd +++ b/inst/extdata/github-repos.Rmd @@ -8,7 +8,7 @@ output: --- ```{r setup, include=FALSE} -knitr::opts_chunk$set( +knitr::opts_chunk[["set"]]( echo = TRUE, cache = TRUE ) @@ -33,7 +33,11 @@ active_repos <- all_repos |> } ) #remove null elements -active_repos <- active_repos[!sapply(active_repos, is.null)] +active_repos <- active_repos[!vapply( + X = active_repos, + FUN = is.null, + FUN.VALUE = logical(1L) +)] ``` @@ -92,5 +96,4 @@ prod_tibble |> use_filter = TRUE, use_search = TRUE ) - ```