From 9648392176b033ffb7ae6bbd2b5048864c0c85fd Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Mon, 5 Apr 2021 14:47:39 +0100 Subject: [PATCH] Exclude cache (#38) --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/check_lintr.R | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 43b563a..a7d5b81 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: inteRgrate Title: Opinionated Package Coding Styles -Version: 1.0.13 +Version: 1.0.14 Authors@R: person(given = "Jumping", family = "Rivers", diff --git a/NEWS.md b/NEWS.md index 0bd9852..a40f243 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# inteRgrate 1.0.13 _2021-03-31_ +# inteRgrate 1.0.14 _2021-04-05_ * Exclude cache/ from linting # inteRgrate 1.0.12 _2021-03-17_ diff --git a/R/check_lintr.R b/R/check_lintr.R index 1598258..0d17a08 100644 --- a/R/check_lintr.R +++ b/R/check_lintr.R @@ -2,18 +2,17 @@ get_exclusions = function() { if (!file.exists(".lintr")) return(c("^R/", "^cache/")) exclusions = read.dcf(".lintr", all = TRUE)$exclusions - if (is.null(exclusions)) return(c("^R/", "^cache/")) - ## Clean up string - exclusions = stringr::str_remove_all(exclusions, "(list\\(|\\)|\")") - exclusions = stringr::str_squish(str_split(exclusions, pattern = ",")[[1]]) - exclusions = paste0("^", exclusions) + if (is.null(exclusions)) return(c("^R/", "^cache/")) + exclusions = stringr::str_split(exclusions, ",")[[1]] + exclusions = stringr::str_remove(exclusions, "list\\W?\\(") + exclusions = stringr::str_remove(exclusions, "\\)$") + exclusions = stringr::str_squish(exclusions) ## Convert to regular expression pattern = paste0("(", paste0(c(exclusions, "^R/", "^cache/"), collapse = "|"), ")") return(pattern) } - lint_files = function() { lint_errors = FALSE lints = lintr::lint_package(exclusions = list("R/RcppExports.R", "renv", "packrat", "cache"))