Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions R/Filterable.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ Filterable <- R6::R6Class(
r <- f[["filter"]](event)
}

if (identical(r, TRUE)){
if (isTRUE(r)){
# do nothing
} else if (identical(r, FALSE)){
} else if (isFALSE(r)){
return(FALSE)
} else {
warning(
Expand Down
32 changes: 16 additions & 16 deletions R/Logger.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ Logger <- R6::R6Class(

# Check if LogEvent should be created
if (
identical(level[[1]] > get("threshold", envir = self), TRUE) ||
identical(getOption("lgr.logging_suspended"), TRUE)
isTRUE(level[[1]] > get("threshold", envir = self)) ||
isTRUE(getOption("lgr.logging_suspended"))
){
return(invisible(msg))
}
Expand Down Expand Up @@ -305,7 +305,7 @@ Logger <- R6::R6Class(
#' @description Log an Event fatal priority
#' @param msg,...,caller see `$log()`
fatal = function(msg, ..., caller = get_caller(-8L)){
if (identical(get("threshold", envir = self) < 100L, TRUE))
if (isTRUE(get("threshold", envir = self) < 100L))
return(invisible())

get("log", envir = self)(
Expand All @@ -321,7 +321,7 @@ Logger <- R6::R6Class(
#' @description Log an Event error priority
#' @param msg,...,caller see `$log()`
error = function(msg, ..., caller = get_caller(-8L)){
if (identical(get("threshold", envir = self) < 200L, TRUE))
if (isTRUE(get("threshold", envir = self) < 200L))
return(invisible())

get("log", envir = self)(
Expand All @@ -337,7 +337,7 @@ Logger <- R6::R6Class(
#' @description Log an Event warn priority
#' @param msg,...,caller see `$log()`
warn = function(msg, ..., caller = get_caller(-8L)){
if (identical(get("threshold", envir = self) < 300L, TRUE))
if (isTRUE(get("threshold", envir = self) < 300L))
return(invisible())

get("log", envir = self)(
Expand All @@ -353,7 +353,7 @@ Logger <- R6::R6Class(
#' @description Log an Event info priority
#' @param msg,...,caller see `$log()`
info = function(msg, ..., caller = get_caller(-8L)){
if (identical(get("threshold", envir = self) < 400L, TRUE))
if (isTRUE(get("threshold", envir = self) < 400L))
return(invisible())

get("log", envir = self)(
Expand All @@ -369,7 +369,7 @@ Logger <- R6::R6Class(
#' @description Log an Event debug priority
#' @param msg,...,caller see `$log()`
debug = function(msg, ..., caller = get_caller(-8L)){
if (identical(get("threshold", envir = self) < 500L, TRUE))
if (isTRUE(get("threshold", envir = self) < 500L))
return(invisible())

get("log", envir = self)(
Expand All @@ -385,7 +385,7 @@ Logger <- R6::R6Class(
#' @description Log an Event trace priority
#' @param msg,...,caller see `$log()`
trace = function(msg, ..., caller = get_caller(-8L)){
if (identical(get("threshold", envir = self) < 600L, TRUE))
if (isTRUE(get("threshold", envir = self) < 600L))
return(invisible())

get("log", envir = self)(
Expand Down Expand Up @@ -781,7 +781,7 @@ LoggerGlue <- R6::R6Class(
public = list(

fatal = function(..., caller = get_caller(-8L), .envir = parent.frame()){
if (identical(get("threshold", envir = self) < 100L, TRUE))
if (isTRUE(get("threshold", envir = self) < 100L))
return(invisible())

force(.envir)
Expand All @@ -795,7 +795,7 @@ LoggerGlue <- R6::R6Class(
},

error = function(..., caller = get_caller(-8L), .envir = parent.frame()){
if (identical(get("threshold", envir = self) < 200L, TRUE))
if (isTRUE(get("threshold", envir = self) < 200L))
return(invisible())

get("log", envir = self)(
Expand All @@ -808,7 +808,7 @@ LoggerGlue <- R6::R6Class(
},

warn = function(..., caller = get_caller(-8L), .envir = parent.frame()){
if (identical(get("threshold", envir = self) < 300L, TRUE))
if (isTRUE(get("threshold", envir = self) < 300L))
return(invisible())

get("log", envir = self)(
Expand All @@ -821,7 +821,7 @@ LoggerGlue <- R6::R6Class(
},

info = function(..., caller = get_caller(-8L), .envir = parent.frame()){
if (identical(get("threshold", envir = self) < 400L, TRUE))
if (isTRUE(get("threshold", envir = self) < 400L))
return(invisible())

get("log", envir = self)(
Expand All @@ -834,7 +834,7 @@ LoggerGlue <- R6::R6Class(
},

debug = function(..., caller = get_caller(-8L), .envir = parent.frame()){
if (identical(get("threshold", envir = self) < 500L, TRUE))
if (isTRUE(get("threshold", envir = self) < 500L))
return(invisible())

force(.envir)
Expand All @@ -848,7 +848,7 @@ LoggerGlue <- R6::R6Class(
},

trace = function(..., caller = get_caller(-8L), .envir = parent.frame()){
if (identical(get("threshold", envir = self) < 600L, TRUE))
if (isTRUE(get("threshold", envir = self) < 600L))
return(invisible())

force(.envir)
Expand Down Expand Up @@ -913,8 +913,8 @@ LoggerGlue <- R6::R6Class(

# Check if LogEvent should be created
if (
identical(level[[1]] > get("threshold", envir = self), TRUE) ||
identical(getOption("lgr.logging_suspended"), TRUE)
isTRUE(level[[1]] > get("threshold", envir = self)) ||
isTRUE(getOption("lgr.logging_suspended"))
){
return(invisible(msg))
}
Expand Down
10 changes: 5 additions & 5 deletions R/utils-sfmisc.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ assert <- function(
call. = FALSE,
domain = NULL
){
if (identical(cond, TRUE)){
if (isTRUE(cond)){
return(TRUE)
} else if (identical(cond, FALSE)){
} else if (isFALSE(cond)){
if (identical(length(list(...)), 0L)){
msg <- paste0("`", deparse(match.call()[[2]]), "`", " is not 'TRUE'")
stop(msg, call. = call., domain = domain)
Expand Down Expand Up @@ -323,7 +323,7 @@ is_bool <- function(x){
#' @noRd
#'
is_scalar_bool <- function(x){
identical(x, TRUE) || identical(x, FALSE)
is.logical(x) && length(x) == 1L && !is.na(x)
}


Expand Down Expand Up @@ -356,14 +356,14 @@ is_scalar_integerish <- function(x){


is_n <- function(x){
is_scalar_integerish(x) && identical(x > 0, TRUE)
is_scalar_integerish(x) && isTRUE(x > 0)
}




is_n0 <- function(x){
is_scalar_integerish(x) && identical(x >= 0, TRUE)
is_scalar_integerish(x) && isTRUE(x >= 0)
}


Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ CannotInitializeAbstractClassError <- function(

# stricter & faster thant base R version & support for R < 3.5
isFALSE <- function(x){
identical(x, FALSE)
is.logical(x) && length(x) == 1L && !is.na(x) && !x
}


Expand Down