Skip to content

Commit

Permalink
fix: improve detection of dependencies - fix #53
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Oct 25, 2023
1 parent ad9c8cd commit fc73f55
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions R/utils-deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ get_deps_in_functions_r <- function() {

## Remove messages ----

x <- lapply(x, function(x) gsub("\".*\"", "", x))
x <- lapply(x, function(x) gsub("\'.*\'", "", x))
x <- lapply(x, function(x) gsub("\".{0,}\'.{0,}\'.{0,}\"", "", x))
x <- lapply(x, function(x) gsub("\'.{0,}\".{0,}\".{0,}\'", "", x))
x <- lapply(x, function(x) gsub("\".{0,}\\\".{0,}\\\".{0,}\"", "", x))
x <- lapply(x, function(x) gsub("\'.{0,}\\\'.{0,}\\\'.{0,}\'", "", x))


## Functions called as pkg::fun() ----
Expand Down Expand Up @@ -77,6 +79,7 @@ get_deps_in_functions_r <- function() {
unlist(stringr::str_extract_all(x, pattern))
}))

pkgs <- gsub("\\s", "", pkgs)
pkgs <- gsub("library\\(|require\\(|\"|\'", "", pkgs)


Expand Down Expand Up @@ -318,8 +321,10 @@ get_deps_extra <- function(compendium = NULL) {

## Remove messages ----

x <- lapply(x, function(x) gsub("\".*\"", "", x))
x <- lapply(x, function(x) gsub("\'.*\'", "", x))
x <- lapply(x, function(x) gsub("\".{0,}\'.{0,}\'.{0,}\"", "", x))
x <- lapply(x, function(x) gsub("\'.{0,}\".{0,}\".{0,}\'", "", x))
x <- lapply(x, function(x) gsub("\".{0,}\\\".{0,}\\\".{0,}\"", "", x))
x <- lapply(x, function(x) gsub("\'.{0,}\\\'.{0,}\\\'.{0,}\'", "", x))


## Functions called as pkg::fun() ----
Expand Down Expand Up @@ -349,6 +354,7 @@ get_deps_extra <- function(compendium = NULL) {
unlist(stringr::str_extract_all(x, pattern))
}))

pkgs <- gsub("\\s", "", pkgs)
pkgs <- gsub("library\\(|require\\(|\"|\'", "", pkgs)


Expand Down Expand Up @@ -434,8 +440,10 @@ get_deps_in_vignettes <- function() {

## Remove messages ----

x <- lapply(x, function(x) gsub("\".*\"", "", x))
x <- lapply(x, function(x) gsub("\'.*\'", "", x))
x <- lapply(x, function(x) gsub("\".{0,}\'.{0,}\'.{0,}\"", "", x))
x <- lapply(x, function(x) gsub("\'.{0,}\".{0,}\".{0,}\'", "", x))
x <- lapply(x, function(x) gsub("\".{0,}\\\".{0,}\\\".{0,}\"", "", x))
x <- lapply(x, function(x) gsub("\'.{0,}\\\'.{0,}\\\'.{0,}\'", "", x))


## Remove inline code (not evaluated) ----
Expand Down Expand Up @@ -474,6 +482,7 @@ get_deps_in_vignettes <- function() {
unlist(stringr::str_extract_all(x, pattern))
}))

pkgs <- gsub("\\s", "", pkgs)
pkgs <- gsub("library\\(|require\\(|\"|\'", "", pkgs)


Expand Down Expand Up @@ -552,8 +561,10 @@ get_deps_in_tests <- function() {

## Remove messages ----

x <- lapply(x, function(x) gsub("\".*\"", "", x))
x <- lapply(x, function(x) gsub("\'.*\'", "", x))
x <- lapply(x, function(x) gsub("\".{0,}\'.{0,}\'.{0,}\"", "", x))
x <- lapply(x, function(x) gsub("\'.{0,}\".{0,}\".{0,}\'", "", x))
x <- lapply(x, function(x) gsub("\".{0,}\\\".{0,}\\\".{0,}\"", "", x))
x <- lapply(x, function(x) gsub("\'.{0,}\\\'.{0,}\\\'.{0,}\'", "", x))


## Functions called as pkg::fun() ----
Expand Down Expand Up @@ -583,6 +594,7 @@ get_deps_in_tests <- function() {
unlist(stringr::str_extract_all(x, pattern))
}))

pkgs <- gsub("\\s", "", pkgs)
pkgs <- gsub("library\\(|require\\(|\"|\'", "", pkgs)


Expand Down

0 comments on commit fc73f55

Please sign in to comment.