Skip to content

nrow_subset_linter() should be pipeline-aware #2314

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

Closed
MichaelChirico opened this issue Nov 18, 2023 · 1 comment · Fixed by #2426
Closed

nrow_subset_linter() should be pipeline-aware #2314

MichaelChirico opened this issue Nov 18, 2023 · 1 comment · Fixed by #2426
Labels
false-negative code that should lint, but doesn't
Milestone

Comments

@MichaelChirico
Copy link
Collaborator

x |>
  subset(conds) |>
  nrow()

And, assuming #2313,

x |>
  filter(conds) |>
  nrow()
@MichaelChirico MichaelChirico added the false-negative code that should lint, but doesn't label Nov 18, 2023
@MichaelChirico
Copy link
Collaborator Author

Copying over test cases:

lintr::expect_lint(
  "x %>% subset(y == z) %>% nrow()",
  "Use arithmetic to count the number of rows satisfying a condition",
  nrow_subset_linter
)
lintr::expect_lint(
  "x %>% filter(y == z) %>% nrow()",
  "Use arithmetic to count the number of rows satisfying a condition",
  nrow_subset_linter
)

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