Skip to content

New lengths_linter - #1568

Merged
MichaelChirico merged 10 commits into
mainfrom
lengths
Oct 1, 2022
Merged

MichaelChirico merged 10 commits into
mainfrom
lengths

Conversation

@MichaelChirico

Copy link
Copy Markdown
Collaborator

Part of #884

Comment thread tests/testthat/test-lengths_linter.R Resolved
Comment thread R/lengths_linter.R Resolved
IndrajeetPatil
IndrajeetPatil previously approved these changes Sep 30, 2022

@IndrajeetPatil IndrajeetPatil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment, but ready otherwise.

Comment thread NEWS.md
`lapply(x, function(xi) sum(xi))` can be `lapply(x, sum)` and `purrr::map(x, ~quantile(.x, 0.75, na.rm = TRUE))`
can be `purrr::map(x, quantile, 0.75, na.rm = TRUE)`. Naming `probs = 0.75` can further improve readability.
* `redundant_equals_linter()` for redundant comparisons to `TRUE` or `FALSE` like `is_treatment == TRUE` (#1500, @MichaelChirico)
* `lengths_linter()` for encouraging usage of `lengths(x)` instead of `sapply(x, length)` (and similar)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sentence complete?

(and other similar functions from apply and map families).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for a complete sentence IMO :)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants