From b96a4f0821ed811097beed90ffbc5374aababdf9 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 5 Jun 2024 11:27:38 +0200 Subject: [PATCH 1/5] docs: Add Rhino 1.8 migration guide. --- pkgdown/_pkgdown.yml | 2 + vignettes/how-to/migrate-1-8.Rmd | 73 ++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 vignettes/how-to/migrate-1-8.Rmd diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 17ab1894..53ae2775 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -110,6 +110,8 @@ navbar: href: articles/how-to/migrate-1-6.html - text: Migration to Rhino 1.7 href: articles/how-to/migrate-1-7.html + - text: Migration to Rhino 1.8 + href: articles/how-to/migrate-1-8.html faq: text: FAQ diff --git a/vignettes/how-to/migrate-1-8.Rmd b/vignettes/how-to/migrate-1-8.Rmd new file mode 100644 index 00000000..5b626ffd --- /dev/null +++ b/vignettes/how-to/migrate-1-8.Rmd @@ -0,0 +1,73 @@ +--- +title: "How-to: Rhino 1.8 Migration Guide" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{How-to: Rhino 1.8 Migration Guide} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +Follow the steps outlined in this guide to migrate your project to Rhino 1.8. +Before starting, ensure your Git working tree is clean, or back up your project if not using Git. + +This guide assumes you are migrating from Rhino 1.6 or 1.7. +If you are currently using an older version of Rhino, +please start with +[Rhino 1.6 Migration Guide](https://appsilon.github.io/rhino/articles/how-to/migrate-1-6.html). + +# Step 1: Install Rhino 1.8 + +Use the following command to install Rhino 1.8 and update your `renv.lock` file: + +```r +rhino::pkg_install("rhino@1.8.0") +``` + +After the installation, restart your R session to ensure all changes take effect. + +# Step 2: Update your linter rules + +## Option A: You use `.lintr` provided by Rhino without modifications + +Run the following command to replace your `.lintr` file with the new default one provided by Rhino: + +```r +box.linters::use_box_lintr(type = "rhino") +``` + +## Option B: You have customized `.lintr` file + +Edit the `.lintr` file in your project so it uses `box.linters::rhino_default_linters` as the default linters: + +```r +linters: + linters_with_defaults( + defaults = box.linters::rhino_default_linters, + line_length_linter = lintr::line_length_linter(100) # You can add your custom linters here + ) +``` + +# Step 3: Update GitHub Actions workflow + +_Note: This step is only necessary if you are using GitHub Actions in your project._ + +To update your workflow, run: +```r +file.copy( + system.file("templates", "github_ci", "dot.github", "workflows", "rhino-test.yml", package = "rhino"), + file.path(".github", "workflows", "rhino-test.yml") +) +``` + +This command will replace the current GitHub Actions workflow with the new Rhino-provided one. +If you have customized your workflow, you will need to manually update it to include the new triggers added to the template. +The changes can be found in [this commit](https://github.com/Appsilon/rhino/commit/8e080655f81865a30af51330cd81f4614d3a7405). + +# Step 4: Test your project + +Test your project thoroughly to ensure everything works properly after the migration. +In particular, run `rhino::lint_r()` and fix the problems it reports. + +If you encounter any issues or have further questions, +don't hesitate to reach out to us via +[GitHub Discussions](https://github.com/Appsilon/rhino/discussions). From 7c6934027842d0a74402b01b555f58c7426a243d Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 5 Jun 2024 11:29:23 +0200 Subject: [PATCH 2/5] docs: Update NEWS.md --- NEWS.md | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/NEWS.md b/NEWS.md index 4f747fa9..6839d77e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,16 +1,7 @@ -# rhino (development version) - -1. All linter functions migrated to `box.linters`. New rhino projects will be configured to use linters from `box.linters`. To migrate an existing rhino project, run: - ```r - box.linters::use_box_lintr(type = "rhino") - ``` -2. Update GitHub Workflow template triggers. To update your workflow run: - ```r - file.copy( - system.file("templates", "github_ci", "dot.github", "workflows", "rhino-test.yml", package = "rhino"), - file.path(".github", "workflows", "rhino-test.yml") - ) - ``` +# rhino 1.8.0 + +1. All linter functions migrated to `box.linters`. New rhino projects will be configured to use linters from `box.linters`. +2. Updated GitHub Workflow template triggers. # [rhino 1.7.0](https://github.com/Appsilon/rhino/releases/tag/v1.7.0) From 2670bb325b8b391a2c2761c77aa2194918307fcf Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 5 Jun 2024 11:41:08 +0200 Subject: [PATCH 3/5] chore: Bump package version. --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index a6e30cf2..3d1888b5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rhino Title: A Framework for Enterprise Shiny Applications -Version: 1.7.0.9002 +Version: 1.8.0 Authors@R: c( person("Kamil", "Żyła", role = c("aut", "cre"), email = "opensource+kamil@appsilon.com"), From ab9de55e7696ee4e175475fc0426ab814152cae0 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 5 Jun 2024 12:25:29 +0200 Subject: [PATCH 4/5] chore: Add link to the migration guide to NEWS.md --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 6839d77e..fcfbc9db 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,8 @@ 1. All linter functions migrated to `box.linters`. New rhino projects will be configured to use linters from `box.linters`. 2. Updated GitHub Workflow template triggers. +See _[How-to: Rhino 1.8 Migration Guide](https://appsilon.github.io/rhino/articles/how-to/migrate-1-8.html)_ + # [rhino 1.7.0](https://github.com/Appsilon/rhino/releases/tag/v1.7.0) See _[How-to: Rhino 1.7 Migration Guide](https://appsilon.github.io/rhino/articles/how-to/migrate-1-7.html)_ From 27ddb8171a243903f67aa6ab67183a63638d537a Mon Sep 17 00:00:00 2001 From: Rodrigo Basa Date: Wed, 5 Jun 2024 18:31:21 +0800 Subject: [PATCH 5/5] add link to lintr's configuring linters --- R/tools.R | 5 ++++- man/lint_r.Rd | 3 ++- vignettes/explanation/rhino-style-guide.Rmd | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/tools.R b/R/tools.R index 859c2ca2..624cd52a 100644 --- a/R/tools.R +++ b/R/tools.R @@ -66,12 +66,14 @@ check_paths <- function(paths) { } } +# nolint start: line_length_linter #' Lint R #' #' Uses the `{lintr}` package to check all R sources in the `app` and `tests/testthat` directories #' for style errors. #' -#' The linter rules can be adjusted in the `.lintr` file. +#' The linter rules can be [adjusted](https://lintr.r-lib.org/articles/lintr.html#configuring-linters) +#' in the `.lintr` file. #' #' You can set the maximum number of accepted style errors #' with the `legacy_max_lint_r_errors` option in `rhino.yml`. @@ -83,6 +85,7 @@ check_paths <- function(paths) { #' @return None. This function is called for side effects. #' #' @export +# nolint end lint_r <- function(paths = NULL) { if (is.null(paths)) { paths <- c("app", "tests/testthat") diff --git a/man/lint_r.Rd b/man/lint_r.Rd index bb17050f..5a348725 100644 --- a/man/lint_r.Rd +++ b/man/lint_r.Rd @@ -18,7 +18,8 @@ Uses the \code{{lintr}} package to check all R sources in the \code{app} and \co for style errors. } \details{ -The linter rules can be adjusted in the \code{.lintr} file. +The linter rules can be \href{https://lintr.r-lib.org/articles/lintr.html#configuring-linters}{adjusted} +in the \code{.lintr} file. You can set the maximum number of accepted style errors with the \code{legacy_max_lint_r_errors} option in \code{rhino.yml}. diff --git a/vignettes/explanation/rhino-style-guide.Rmd b/vignettes/explanation/rhino-style-guide.Rmd index 393410bc..c3baa44d 100644 --- a/vignettes/explanation/rhino-style-guide.Rmd +++ b/vignettes/explanation/rhino-style-guide.Rmd @@ -13,6 +13,8 @@ These rules are designed to work alongside `tidyverse` conventions, providing cl For more details on how to use `box::use` statements, see [Explanation: Box modules](https://appsilon.github.io/rhino/articles/explanation/box-modules.html). +For more details on how to configure linter rules in the `.lintr` file, see [Configuring linters](https://lintr.r-lib.org/articles/lintr.html#configuring-linters). + # Explicit Import For clarity and ease of tracking function origins, avoid using `[...]` for imports. Explicitly declare all packages, modules and functions.