-
Notifications
You must be signed in to change notification settings - Fork 341
Make error from finding arguments in '...' in expect_condition (et al) more informative #2055
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
429eabf
rename helper argument to match the arg name in parent
MichaelChirico b226799
proposed fix for ambiguous error message
MichaelChirico ec92bbd
style: message ends with "."
MichaelChirico 95354d4
Merge branch 'main' into check-dots-informative
MichaelChirico e06c270
Merged origin/main into MichaelChirico-check-dots-informative
hadley 0072b66
we can assume R 4.1.0 now :)
MichaelChirico 7873bcc
missing ")"
MichaelChirico 795d205
rename in other cnd_matcher call site
MichaelChirico 6368905
some dev friendliness skips
MichaelChirico 887f508
kludge snapshots
MichaelChirico 2826eee
Merge commit '1988ac82050ee0b360ea3094c49b87842a9bf678'
hadley cdc7f3a
Move to own function
hadley 5af66e5
More tweaking
hadley 3ddadcb
Apply suggestions from code review
hadley 6ca1ee7
Code review feedback
hadley 86d7bc0
Tweak hint
hadley 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
| expect_error(stop("!"), regexp = 1) | ||
| Condition | ||
| Error in `expect_error()`: | ||
| ! `pattern` must be a single string, `NA`, or `NULL`, not the number 1. | ||
| ! `regexp` must be a single string, `NA`, or `NULL`, not the number 1. | ||
| Code | ||
| expect_error(stop("!"), class = 1) | ||
| Condition | ||
|
|
@@ -35,12 +35,28 @@ | |
| expect_condition(stop("Hi!"), foo = "bar") | ||
| Condition | ||
| Error in `expect_condition()`: | ||
| ! Can't specify `...` without `pattern`. | ||
| ! Can't supply `...` unless `regexp` is set. | ||
| * Unusued arguments: `foo`. | ||
| i `...` is passed to `grepl()` if and only if the `regexp` argument is used. | ||
| Code | ||
| expect_condition(stop("Hi!"), , , "bar") | ||
| Condition | ||
| Error in `expect_condition()`: | ||
| ! Can't supply `...` unless `regexp` is set. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how actionable this is, OTOH, I think it's unlikely to arise organically anyway (this is very strange code). Not worth spending more time on it IMO. |
||
| * Unusued arguments: `..1`. | ||
| i `...` is passed to `grepl()` if and only if the `regexp` argument is used. | ||
| Code | ||
| expect_condition(stop("Hi!"), , , "bar", foo = "bar") | ||
| Condition | ||
| Error in `expect_condition()`: | ||
| ! Can't supply `...` unless `regexp` is set. | ||
| * Unusued arguments: `..1` and `foo`. | ||
| i `...` is passed to `grepl()` if and only if the `regexp` argument is used. | ||
| Code | ||
| expect_condition(stop("Hi!"), "x", foo = "bar") | ||
| Condition | ||
| Error in `expect_condition()`: | ||
| ! Failed to compare condition to `pattern`. | ||
| ! Failed to compare condition to `regexp`. | ||
| Caused by error in `grepl()`: | ||
| ! unused argument (foo = "bar") | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
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.
ah, in case it matters, I just came across this admonition to continue avoiding
...names()until 4.1.3 😱r-lib/lintr#2502
https://github.com/r-lib/lintr/blob/dc8f14996fc303d40f120eea6d56fb54187dbc9c/R/lint.R#L43