-
Notifications
You must be signed in to change notification settings - Fork 39
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
Improve error message + tweak function signature respect error_arg
for allow_rename = FALSE
#358
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
519267e
`use_standalone("r-lib/rlang")` `purrr` and `obj-type` + update snaps…
olivroy 05149d8
Tweak function signature to be more consistent
olivroy e734c6c
Use regular snapshot tests with `cnd_class`
olivroy a761011
use standard type checking
olivroy 9938eb5
Respect `error_arg` with `allow_rename = FALSE`
olivroy 972a200
Standardize on putting `cnd_class = TRUE` on the same line to make it…
olivroy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #336 I think I was hoping that we could somehow mention the expression where the rename happens in the error message.
ensure_named()
is only called byvars_select_eval()
and that does have theexpr
. So you could passexpr
through toensure_named()
and useas_label(expr)
on it to get something nice to include in the error message. LikeFor something like
c(all_of(x), y)
if the rename happens in theall_of(x)
, it would still report the fullc(all_of(x), y)
as the place where the rename happened, but I think that is ok, it is hard to be more precise. I still think this would be a big improvement.I think adding the argument name is nice, but maybe not quite as good as it could be on its own. For example this dplyr error from tidyverse/dplyr#6745 would have been:
But the user typed in
mtcars %>% rename_with(toupper, all_of(v))
so.cols
isn't immediately meaningful to them. But this:is probably enough for them to figure out where to look next, because it refers to something in their code
WDYT @lionel- ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use the "In argument" pattern for consistency.