-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Move the check on misuse of data.frame() to tests #3758
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
Move the check on misuse of data.frame() to tests #3758
Conversation
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. |
Thanks, I added some simple tests. |
…a.frame-warning-to-test
@yutannihilation can we merge this in in its current form? |
Yes, since this is just about testing, I think it's safe to merge this. |
…a.frame-warning-to-test
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.
LGTM
Thanks |
Move the check on misuse of data.frame() to tests (tidyverse#3758)
#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.