Skip to content

Commit

Permalink
lose styler dep
Browse files Browse the repository at this point in the history
  • Loading branch information
msberends committed Jun 13, 2024
1 parent acaa6f8 commit cd2243c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: certestyle
Title: A Certe R Package for Applying Certe Organisational Style
Version: 1.6.7
Version: 1.6.8
Authors@R: c(
person(given = c("Matthijs", "S."),
family = "Berends",
Expand All @@ -25,7 +25,6 @@ Imports:
purrr (>= 0.3.4),
readr (>= 1.4.0),
rstudioapi (>= 0.8),
styler (>= 1.3.2),
viridisLite (>= 0.4.0),
yaml (>= 2.2.0)
Suggests:
Expand All @@ -37,6 +36,7 @@ Suggests:
knitr (>= 1.0.0),
pillar (>= 1.5.0),
rmarkdown,
styler (>= 1.3.2),
testthat (>= 2.0.0),
tibble (>= 3.0.0)
License: GPL-2
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,5 @@ importFrom(rstudioapi,convertTheme)
importFrom(rstudioapi,getThemeInfo)
importFrom(rstudioapi,getThemes)
importFrom(rstudioapi,removeTheme)
importFrom(styler,tidyverse_style)
importFrom(viridisLite,viridis)
importFrom(yaml,read_yaml)
8 changes: 5 additions & 3 deletions R/styler.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' `options(styler.addins_style_transformer = "certe_style_transformer()")`
#'
#' Then use the keyboard shortcut of the `styler` package to apply the formatting.
#' @param ... arguments passed on to [styler::tidyverse_style()]
#' @param ... arguments passed on to `styler::tidyverse_style()`
#' @details The Certe styler keeps the first argument of a function on the same line, puts all following arguments on a new line, and does not add another new line after the last argument. This makes these lines:
#'
#' ```
Expand All @@ -45,11 +45,13 @@
#' y.title = "Count",
#' title = "Count isolates per hospital/gender")
#' ```
#' @importFrom styler tidyverse_style
#' @importFrom purrr some negate
#' @export
certe_style_transformer <- function(...) {
certe_style <- tidyverse_style(...)
if (!"styler" %in% rownames(utils::installed.packages())) {
stop("This requires the 'styler' package", call. = FALSE)
}
certe_style <- styler::tidyverse_style(...)

# line breaks between *all* arguments if line breaks between *any*
certe_style$line_break$set_linebreak_each_argument_if_multi_line <- function(pd) {
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ s3_register <- function(generic, class, method = NULL) {
registerS3method(generic, class, method_fn, envir = envir)
}
invisible()
}
}
2 changes: 1 addition & 1 deletion man/certe_style_transformer.Rd

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

4 changes: 2 additions & 2 deletions man/colourpicker.Rd

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

0 comments on commit cd2243c

Please sign in to comment.