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

Extensions for the sum() case in boolean_arithmetic_linter #1580

Closed
5 tasks
MichaelChirico opened this issue Sep 30, 2022 · 0 comments · Fixed by #2814
Closed
5 tasks

Extensions for the sum() case in boolean_arithmetic_linter #1580

MichaelChirico opened this issue Sep 30, 2022 · 0 comments · Fixed by #2814
Labels
false-negative code that should lint, but doesn't

Comments

@MichaelChirico
Copy link
Collaborator

MichaelChirico commented Sep 30, 2022

Follow-up to #1579: boolean_arithmetic_linter() can also detect some other cases of sum(<known logical vector>) == 0 --> any(<known logical vector>):

  • sum(x %in% y)
  • sum(x | y) / sum(x & y)
  • sum(!x)
  • Other common logical vector-output functions like is.na(), is.nan(), is.finite(), is.element()
  • stringr equivalent of grep() --> str_detect() recommended
@MichaelChirico MichaelChirico added the false-negative code that should lint, but doesn't label Sep 30, 2022
MichaelChirico added a commit that referenced this issue Sep 30, 2022
IndrajeetPatil added a commit that referenced this issue Oct 2, 2022
* New boolean_arithmetic_linter

* follow-up #1580

* Follow-up #1581

* Update R/boolean_arithmetic_linter.R

* update docs and linter counts

Co-authored-by: Indrajeet Patil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-negative code that should lint, but doesn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant