Skip to content

Commit

Permalink
Exclude cache (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
csgillespie authored Apr 5, 2021
1 parent c812ab2 commit 9648392
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
11 changes: 5 additions & 6 deletions R/check_lintr.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 9648392

Please sign in to comment.