Closed fweber144 closed 1 year ago
This hasn't been touched recently and, in particular, not on my watch.
In the NEWS file, I find this, indicating the deprecation happened 6 years ago:
https://github.com/r-lib/devtools/blame/8ef16cfc09394db710740d25e48cfc958e804f15/NEWS.md#L789-L790
The
cleanup
argument tocheck()
is deprecated: it now always returns the path to the check directory.
So even though it sounds like you thought you were relying on this argument to get some behaviour, I don't think it has actually been doing anything for you. If you're noticing some change in your life, I think there's likely some other explanation.
Yes, the deprecation already happened some time ago. But now in v2.4.4 it was defunct, i.e., using cleanup = FALSE
leads to an error now, not only a warning. Reprex:
R CMD check
warning, specify the License:
field in the DESCRIPTION
file of the newly created R package (e.g., setting it to GPL-3
).R CMD check
via RStudio's keyboard shortcut Ctrl + Shift + E
while being in the R project corresponding to the newly created R package.With devtools v2.4.3, I get Warning: `cleanup` is deprecated
at the beginning of the output from the "Build" pane, but the check runs through and as desired, the check directory (at ../<package_name>.Rcheck
) is not deleted. In contrast, with devtools v2.4.4, the check aborts directly at the beginning with the error message
Error: The `cleanup` argument of `check()` was deprecated in lifecycle 1.11.0 and is now defunct.
Execution halted
Exited with status 1.
Warning: `cleanup` is deprecated
at the beginning of the output from the "Build" pane anymore and as before, the check runs through, but the check directory (at ../<package_name>.Rcheck
) is deleted (as expected). With devtools v2.4.4, the behavior is the same as with v2.4.3: The check runs through, but the check directory (at ../<package_name>.Rcheck
) is deleted (as expected).So, in summary, there is no way to keep the check directory at ../<package_name>.Rcheck
with devtools v2.4.4. That's the reason for my question above: the recommended alternative to cleanup = FALSE
with devtools v2.4.4.
My RStudio version is:
RStudio 2022.07.0+548 "Spotted Wakerobin" Release (34ea3031089fa4e38738a9256d6fa6d70629c822, 2022-07-06) for Ubuntu Jammy
Given my comment above, may I ask @jennybc to re-open this? Sorry for not including a reprex in the first place.
I conducted some experiments and have found out the following:
devtools::check(document = FALSE, check_dir = "..", args = "--output=.")
or devtools::check(document = FALSE, check_dir = "..")
at the RStudio console keeps the <package_name>.Rcheck
directory after the check (and also the <package_name>_<package_version>.tar.gz
file). This holds for devtools 2.4.3 as well as 2.4.4, so this could be the desired alternative. However, this requires to run devtools::check()
at the console. Running it in RStudio's build pane via RStudio's keyboard shortcut Ctrl + Shift + E
is more convenient, I think. This is what point 2 below is about.--output=..
in the additional R CMD check
arguments of the Project Options (in RStudio) and then running the check in RStudio's build pane via Ctrl + Shift + E
, the <package_name>.Rcheck
directory is kept. However, that <package_name>.Rcheck
directory is then not at the same directory level as the folder containing the RStudio project (i.e., <package_name>
), but one level up. This is definitely a downside. Strangely, specifying --output=.
in the additional R CMD check
arguments of the Project Options causes the <package_name>.Rcheck
directory to be deleted after the check. Also note that the <package_name>_<package_version>.tar.gz
file is not kept (it seems to be put to a temporary directory which does not exist anymore after the check). With devtools 2.4.3, the behavior is the same when selecting the global option "Cleanup output after successful R CMD check", but it slightly differs when deselecting that global option: In that case, the <package_name>_<package_version>.tar.gz
file is kept at the same level as the folder containing the RStudio project (i.e., <package_name>
).Thus, I guess the problem is mainly with RStudio. Currently, I think there are the following RStudio-related problems, apart from the downside I mentioned in point 2 above (the check directory being one level up):
--output
flag in the additional R CMD check
arguments of the Project Options of each RStudio project that involves package checking. Having a global option such as the now (with devtools 2.4.4) unusable global option "Cleanup output after successful R CMD check" would be more convenient.<package_name>.Rcheck
directory is not deleted (see the --output=..
demonstration in point 2 above). I'm happy with it because it allows me to keep that directory, but it's strange from a UI perspective.Because of these RStudio-related issues, I will create a new RStudio issue. However, there are also some problems with devtools, I think:
cleanup
still shows a default of TRUE
. Of course, its documentation says it's deprecated, but users could still think that devtools::check()
cleans up after a check (which it does not, see the devtools::check()
call in point 1 above but even the simpler call devtools::check(document = FALSE)
causes the <package_name>.Rcheck
directory to be kept in the corresponding temporary folder). Thus, if argument cleanup
should be kept in the future, then I think its default should be changed to FALSE
.In my opinion, the first sentence in the documentation of argument check_dir
is a bit confusing. It reads:
the directory in which the package is checked compatibility.
I would have considered argument check_dir
earlier for a workaround, but that sentence made me think it would not help.
For reference, this is where the IDE was relying on cleanup = FALSE
for devtools::check()
:
I'm guessing most users left the default preferences here, hence why this is the first time we're seeing this now.
This is where Hadley made the change:
Was that change really intentional? If so, it seems like it should be accompanied by a NEWS entry?
It seems like, as far as the IDE is concerned, we can just stop using cleanup = FALSE
and rely on our own code which manually deletes the .Rcheck
directory (if appropriate) after calling devtools::check()
.
I'm confident the deprecation was intentional, so I'm implementing suggestions from @fweber144 to make the situation more clear for any user who bangs their shins against this.
Thank you, @jennybc and @kevinushey, for spending your time on this. Your suggestions sound reasonable to me.
It seems like argument
cleanup
ofdevtools::check()
has been defunct in devtools v2.4.4. I realized this after updating devtools to v2.4.4 and then runningR CMD check
via RStudio's keyboard shortcutCtrl + Shift + E
on one of my packages. I have deselected option "Cleanup output after successful R CMD check" in RStudio's global options. My question is now what the recommended alternative tocleanup = FALSE
is. I couldn't find anything about that in the documentation and neither by searching the internet.