Closed m-muecke closed 2 weeks ago
Ah, I guess I forget of the use-case where NULL
or NA
wants be checked:
!isTRUE(NULL) == isFALSE(NULL)
#> [1] FALSE
!isTRUE(NA) == isFALSE(NA)
#> [1] FALSE
Created on 2024-06-14 with reprex v2.1.0
Oh, true, more generally,
isTRUE(x) <=> length(x) == 1 && is.logical(x) && !is.na(x) && x
isFALSE(x) <=> length(x) == 1 && is.logical(x) && !is.na(x) && !x
So !isTRUE(x) != isFALSE(x)
whenever length(x) != 1 || !is.logical(x) || is.na(x)
.
So actually I'm not sure there's anything we can do here statically.
Good idea. I think it can be part of
comparison_negation_linter()
.Here are 10Ks of hits:
https://github.com/search?q=lang%3AR+%2F%5B%21%5D%5Cs*isTRUE%5C%28%2F&type=code