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

Improved input validation #1407

Merged
merged 26 commits into from
Oct 18, 2022
Merged

Improved input validation #1407

merged 26 commits into from
Oct 18, 2022

Conversation

hadley
Copy link
Member

@hadley hadley commented Oct 18, 2022

Using rlang's new check_ helpers. Fixes #1400

@hadley hadley merged commit 0bff66c into main Oct 18, 2022
@hadley hadley deleted the improved-errors branch October 18, 2022 21:56
R/nest-legacy.R Show resolved Hide resolved
! `values_from` must select at least one column.
! Must select at least one item.
Copy link
Member

Choose a reason for hiding this comment

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

These used to report names_from vs values_from as the place where the problem came from, which was nice

Copy link
Member Author

Choose a reason for hiding this comment

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

dplyr::filter(n > 1L)
dplyr::group_by(a, key) %>%
dplyr::summarise(n = dplyr::n(), .groups = "drop") %>%
dplyr::filter(n > 1L)
Copy link
Member

Choose a reason for hiding this comment

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

I think the tabbing is off? i.e. {data} shouldn't be aligned with the following lines right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, but I gave up getting cli to not re-indent.

Copy link
Member

Choose a reason for hiding this comment

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

Oh that is unfortunate

uncount(df, x, .id = "")
Condition
Error in `uncount()`:
! `.id` must be a valid name or `NULL`, not the empty string "".
Copy link
Member

Choose a reason for hiding this comment

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

I noticed in stringr error messages you backtick the "" but we didn't do that in the rlang check functions

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

Successfully merging this pull request may close these issues.

Use new rlang check_ helpers
2 participants