Move the check on misuse of data.frame() to tests#3758
Merged
yutannihilation merged 6 commits intotidyverse:masterfrom Mar 26, 2021
Merged
Conversation
Member
|
I like this approach, but I'd like to suggest that we should also test the test (i.e., include a true positive). Add a file to the testthat directory that contains the prohibited functions and check that the counts of prohibited functions for that file are correct. |
Member
Author
|
Thanks, I added some simple tests. |
…a.frame-warning-to-test
Member
|
@yutannihilation can we merge this in in its current form? |
Member
Author
|
Yes, since this is just about testing, I think it's safe to merge this. |
…a.frame-warning-to-test
Member
Author
|
Thanks |
sthagen
added a commit
to sthagen/tidyverse-ggplot2
that referenced
this pull request
Mar 27, 2021
Move the check on misuse of data.frame() to tests (tidyverse#3758)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#3526 introduced the static analysis of codes here.
ggplot2/tests/testthat/test-conditions.R
Lines 3 to 21 in 214f314
This approach seems very clean and extensive because this catches the misuse of the prohibited function even if it's on the rare code path. I think the check on
data.frame()should be done in the same way instead of overwriting the function. One bonus of this is that we'll be less likely to face such mysterious issues as #3745.