Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Should any_is_na_linter() be extended to cover sum(is.na(x)) != 0L? #1575

Closed
IndrajeetPatil opened this issue Sep 30, 2022 · 5 comments
Closed

Comments

@IndrajeetPatil
Copy link
Collaborator

It doesn't seem that uncommon of a pattern to find NAs.

library(lintr)

x <- rep(c(TRUE, NA, FALSE, FALSE), 1000)

identical(
  sum(is.na(x)) != 0L, 
  anyNA(x)
)
#> [1] TRUE

# currently doesn't lint
lint(
  text = "sum(is.na(x)) != 0L",
  linters = any_is_na_linter()
)

Created on 2022-09-30 with reprex v2.0.2

@MichaelChirico
Copy link
Collaborator

MichaelChirico commented Sep 30, 2022 via email

@IndrajeetPatil
Copy link
Collaborator Author

I don't see BooleanArithmeticLinter in #884, but maybe it's not included there.

Sounds good to me.

@MichaelChirico
Copy link
Collaborator

MichaelChirico commented Sep 30, 2022 via email

@IndrajeetPatil
Copy link
Collaborator Author

So exciting!

happy-smile

@MichaelChirico
Copy link
Collaborator

Subsuming this under #1580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants