Skip to content

Commit

Permalink
doc: doc for code coverage in inflate and inflate_all
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohann Mansiaux committed Jun 12, 2024
1 parent d85ebbe commit f63ec24
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
7 changes: 6 additions & 1 deletion R/inflate_all.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@
#' inflate_all(check = FALSE, document = TRUE)
#' })
#'
#' # If you wish, the code coverage can be computed
#' usethis::with_project(dummypackage, {
#' # now you can run inflate_all()
#' inflate_all(check = FALSE, document = TRUE, codecov = TRUE)
#' })
#'
#' # Clean the temporary directory
#' unlink(dummypackage, recursive = TRUE)
inflate_all <- function(
Expand Down Expand Up @@ -200,7 +206,6 @@ inflate_all <- function(
)

if (codecov) {
print("entering codecov")
cli::cli_alert_info("Computing code coverage - it might take some time")
print(
covr::package_coverage()
Expand Down
11 changes: 10 additions & 1 deletion dev/flat_inflate_all.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ There is a wrapper named `inflate_all_no_check()` that will prevent running `dev

Note also that all files stored in R, tests and vignettes directories are checked to detect those not created from a flat file. They will need to be registered in the config file too, in order to help you keep your package clean of deprecated files. `inflate_all()` thus runs `check_not_registered_files()` behind the scene and informs about the procedure. Read `vignette('register-files-in-config', package = 'fusen')` to get more information.

## Compute the code coverage

If you want to compute the code coverage of your package, you can run `inflate_all(codecov = TRUE)`. It will run `covr::package_coverage()` at the end of the process.

## Complete the process with your own code style

You can run your preferred styling functions just before the check of the package in `inflate_all()`. For instance, if you want {styler} package to clean your code during the inflate process, you can run `inflate_all(stylers = styler::style_pkg)`. If you also would like to clean the "dev/" directory, you can run `inflate_all(stylers = function() {styler::style_pkg(); styler::style_dir("dev")})`.
Expand Down Expand Up @@ -204,7 +208,6 @@ inflate_all <- function(
)
if (codecov) {
print("entering codecov")
cli::cli_alert_info("Computing code coverage - it might take some time")
print(
covr::package_coverage()
Expand Down Expand Up @@ -275,6 +278,12 @@ usethis::with_project(dummypackage, {
inflate_all(check = FALSE, document = TRUE)
})
# If you wish, the code coverage can be computed
usethis::with_project(dummypackage, {
# now you can run inflate_all()
inflate_all(check = FALSE, document = TRUE, codecov = TRUE)
})
# Clean the temporary directory
unlink(dummypackage, recursive = TRUE)
```
Expand Down
6 changes: 6 additions & 0 deletions man/inflate_all.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vignettes/inflate-all-your-flat-files.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ There is a wrapper named `inflate_all_no_check()` that will prevent running `dev

Note also that all files stored in R, tests and vignettes directories are checked to detect those not created from a flat file. They will need to be registered in the config file too, in order to help you keep your package clean of deprecated files. `inflate_all()` thus runs `check_not_registered_files()` behind the scene and informs about the procedure. Read `vignette('register-files-in-config', package = 'fusen')` to get more information.

## Compute the code coverage

If you want to compute the code coverage of your package, you can run `inflate_all(codecov = TRUE)`. It will run `covr::package_coverage()` at the end of the process.

## Complete the process with your own code style

You can run your preferred styling functions just before the check of the package in `inflate_all()`. For instance, if you want {styler} package to clean your code during the inflate process, you can run `inflate_all(stylers = styler::style_pkg)`. If you also would like to clean the "dev/" directory, you can run `inflate_all(stylers = function() {styler::style_pkg(); styler::style_dir("dev")})`.
Expand Down Expand Up @@ -122,6 +126,12 @@ usethis::with_project(dummypackage, {
inflate_all(check = FALSE, document = TRUE)
})
# If you wish, the code coverage can be computed
usethis::with_project(dummypackage, {
# now you can run inflate_all()
inflate_all(check = FALSE, document = TRUE, codecov = TRUE)
})
# Clean the temporary directory
unlink(dummypackage, recursive = TRUE)
```
Expand Down

0 comments on commit f63ec24

Please sign in to comment.