Skip to content
New issue

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

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

Already on GitHub? # to your account

perf: use anyNA() and lengths() #2592

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion R/active.R
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ find_active_file <- function(arg = "file", call = parent.frame()) {

find_test_file <- function(path, call = parent.frame()) {
type <- test_file_type(path)
if (any(is.na(type))) {
if (anyNA(type)) {
file <- path_file(path[is.na(type)])
cli::cli_abort(
"Don't know how to find tests associated with the active file {.file {file}}",
4 changes: 2 additions & 2 deletions R/check-devtools.R
Original file line number Diff line number Diff line change
@@ -28,10 +28,10 @@

parsed <- lapply(deps$version, function(x) unlist(numeric_version(x)))

lengths <- vapply(parsed, length, integer(1))
lens <- lengths(parsed)

Check warning on line 31 in R/check-devtools.R

Codecov / codecov/patch

R/check-devtools.R#L31

Added line #L31 was not covered by tests
last_ver <- vapply(parsed, function(x) x[[length(x)]], integer(1))

is_dev <- lengths == 4 & last_ver >= 9000
is_dev <- lens == 4 & last_ver >= 9000

Check warning on line 34 in R/check-devtools.R

Codecov / codecov/patch

R/check-devtools.R#L34

Added line #L34 was not covered by tests

check_status(
!any(is_dev),
3 changes: 1 addition & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
compact <- function(x) {
is_empty <- vapply(x, function(x) length(x) == 0, logical(1))
x[!is_empty]
x[lengths(x) > 0]

Check warning on line 2 in R/utils.R

Codecov / codecov/patch

R/utils.R#L2

Added line #L2 was not covered by tests
}

"%||%" <- function(a, b) if (!is.null(a)) a else b
Loading