-
Notifications
You must be signed in to change notification settings - Fork 37
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
Core Function Changes to Accommodate Empty Lists in Recursion, Covr Behavior on Windows & Vignette Path Warnings #322
Conversation
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.
Thanks for the thorough description with links and the reasoning for these changes. I am totally on-board. I agree, the vignette path checks were excessive... {pkgnet}
doesn't need to be in the business of also teaching people how to create R packages or keep up with the existing standards in the area of packaging vignettes.
I left some minor comments for your consideration, but overall I totally support this.
@@ -174,51 +174,3 @@ test_that("Test that CreatePackageVignette errors for bad inputs", { | |||
, fixed = TRUE | |||
) | |||
}) | |||
|
|||
test_that("CreatePackageVignette warns if vignette_path seems wrong", { |
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.
Yeah I agree this can be removed.
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.
The fix itself looks good.
However, I think we should add some new tests. Additionally, I think the PR description (and issue #320) could better document what the conditions are for the bug and what is being fixed.
From looking over things, it seems like the bug (that we've always had but just never run into) is that our function parsing didn't handle control statements like break
. It seems next
also behaves the same way.
is.symbol(quote(break))
#> [1] FALSE
as.list(quote(break))
#> [[1]]
#> `break`
is.symbol(quote(next))
#> [1] FALSE
as.list(quote(next))
#> [[1]]
#> `next`
Created on 2024-05-01 with reprex v2.0.2
I don't see comments in #320 or anything in this PR's description that says something like "Fixes error in .parse_function
and .parse_R6_expression
when parsing function bodies that contain control statements like break
and next
." The "how we found it" (R6 added some code with break
in it) is good to know but not the full story.
We have a bunch of tests for .parse_function
for specific cases here and I think it would be good to add tests that contain for loops with break
and next
.
specified the function that break and better described the reason.
@jayqi fair feedback. I added more to the notes and added a new test package, @jameslamb I reverted some of your suggested refactor above as it was failing tests. Did not have time to address. Can tackle in a later PR. |
ok sure, no problem! |
This PR makes changes to core functions and associated tests in three areas:
(1) Errors Caused by Control Statements Found During R6 and Normal Function Recursion
Full journey is documented in in #320, but in short:
R6
made a change in their code, now present in2.5.1.9000
R6#247.break
.FunctionReporter
to arrive at an empty list when parsing our test packagemilne
..parse_R6_expression
and.parse_function
respectively.(2) Covr Behavior on Windows
We run
covr
on a package that has already been loaded within the coverage functionality ofCreatePackageReport()
. This is fine on linux and mac, but breaks windows. Therefore, logic added to detach and reattach the package when running on windows. More on the issue fromcovr
here: covr#443(3) Checks for directory naming and location of a custom
vignette_path
In
CreatePackageVignette()
, we provided the ability for a user to specify a customvignette_path
, the location of the file in which to output the vignette. We confirm the path and the extension are valid. However, we also check that the path ends in avignette
directory and warns if not.This warning was correctly failing on windows devel tests (unsure why they were passing elsewhere). However, these checks are excessive. For a user that wants to specify a custom vignette file output, they likely have good reason to do so. Where that location may be does not need to be a concern. By confirm paths are valid and output paths in the terminal and log, we provide the user enough feedback to assess their own custom locations.
Therefore, these warnings and their associated checks were removed.