Skip to content

Commit

Permalink
Merge branch 'main' into standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil authored Sep 24, 2023
2 parents a2b8ad4 + 957d64f commit 30e8f15
Show file tree
Hide file tree
Showing 58 changed files with 73 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-all-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -56,6 +56,7 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
error-on: 'ifelse(getRversion() > 3.6, "warning", "note")'
error-on: 'ifelse(getRversion() > "3.6", "warning", "note")'
env:
_R_CHECK_FORCE_SUGGESTS_: false
_R_CHECK_STOP_ON_INVALID_NUMERIC_VERSION_INPUTS_: true
2 changes: 1 addition & 1 deletion .github/workflows/check-link-rot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -39,7 +39,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.2
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
clean: false
branch: gh-pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/touchstone-receive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
config: ${{ steps.read_touchstone_config.outputs.config }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_language_version:

repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: f3498c421d68a1db26de1a1fe3ecc91dd6f03b5e
rev: v0.3.2.9019
hooks:
- id: style-files
args:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: styler
Title: Non-Invasive Pretty Printing of R Code
Version: 1.10.1
Version: 1.10.2
Authors@R:
c(person(given = "Kirill",
family = "Müller",
Expand Down
20 changes: 20 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
<!-- NEWS.md is maintained by https://cynkra.github.io/fledge, do not edit -->

# styler 1.10.2

This release was requested by the CRAN team to fix CRAN warning on invalid
numeric version inputs (#1143).

**Minor changes**

* Use cli messaging for cache (#1127).
* Use latest (and stable!) pre-commit (#1144).
* Fix CRAN warning on invalid numeric version inputs (#1143).
* Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3 (#1139).
* fix pre-commit (#1132).
* Don't require dplyr anywhere (#1131).

We thank everyone who helped making this release possible.

[&#x0040;krlmlr](https://github.com/krlmlr), [&#x0040;lorenzwalthert](https://github.com/lorenzwalthert), [&#x0040;MichaelChirico](https://github.com/MichaelChirico), [&#x0040;olivroy](https://github.com/olivroy), [&#x0040;rkrug](https://github.com/rkrug), and [&#x0040;rossdrucker](https://github.com/rossdrucker).

# styler 1.10.1

This release was requested by CRAN due to accidentally populating a user cache while building vignettes for R >= 4.3.0.
Expand Down
2 changes: 1 addition & 1 deletion R/nest.R
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ nest_parse_data <- function(pd_flat) {

rhs <- nest_(child, "child", setdiff(names(child), "parent_"))

nested <- left_join(internal, rhs, by = c("id" = "parent_"))
nested <- left_join(internal, rhs, by = c(id = "parent_"))

children <- nested$child
for (i in seq_along(children)) {
Expand Down
1 change: 0 additions & 1 deletion R/parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ ensure_correct_txt <- function(pd, text) {
#' changes from "all strings" to "all problematic strings", is partly
#' misleading and this approach was chosen for performance reasons only.
#' @param pd A parse table.
#' @param text The initial code to style.
#' @keywords internal
is_insufficiently_parsed_string <- function(pd) {
grepl("^\\[", pd$text) & pd$token == "STR_CONST"
Expand Down
2 changes: 1 addition & 1 deletion R/rules-indention.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ indent_braces <- function(pd, indent_by) {
#' @keywords internal
unindent_fun_dec <- function(pd, indent_by = 2L) {
if (is_function_declaration(pd)) {
idx_closing_brace <- which(pd$token %in% "')'")
idx_closing_brace <- which(pd$token == "')'")
fun_dec_head <- seq2(2L, idx_closing_brace)
if (is_double_indent_function_declaration(pd, indent_by = indent_by)) {
pd$indent[fun_dec_head] <- 2L * indent_by
Expand Down
23 changes: 11 additions & 12 deletions R/rules-line-breaks.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ style_line_break_around_curly <- function(strict, pd) {
closing_before <- pd$token == "'}'"
opening_before <- (pd$token == "'{'")
to_break <- lag(opening_before, default = FALSE) | closing_before
len_to_break <- sum(to_break)
pd$lag_newlines[to_break] <- ifelse(
pd$token[to_break] == "COMMENT",
pmin(1L, pd$lag_newlines[to_break]),
Expand Down Expand Up @@ -268,21 +267,20 @@ set_line_break_after_assignment <- function(pd) {

#' Set line break for multi-line function calls
#' @param pd A parse table.
#' @param except_token_after A character vector with tokens after "'('" that do
#' not cause a line break after "'('".
#' @param except_text_before A character vector with text before "'('" that do
#' not cause a line break after "'('".
#' @param except_token_before A character vector with text before "')'" that do
#' not cause a line break before "')'".
#' @param force_text_before A character vector with text before "'('" that
#' forces a line break after every argument in the call.
#' @param except_token_before A character vector with tokens that do
#' not cause a line break after them.
#' @name set_line_break_if_call_is_multi_line
#'
#' @keywords internal
NULL

#' Sets line break after opening parenthesis
#'
#' @param pd The parse table.
#' @param except_token_after The tokens after the token that cause an exception.
#' @param except_text_before A character vector with text before a token that
#' does not cause a line break.
#' @param force_text_before A character vector with text before "'('" that
#' forces a line break after every argument in the call.
#' @details
#' In general, every call that is multi-line has a line break after the opening
#' parenthesis. Exceptions:
Expand Down Expand Up @@ -341,7 +339,7 @@ set_line_break_after_opening_if_call_is_multi_line <- function(pd,
#' position of the first named argument and breaks returns the index of it.
#' If there is no named argument, the line is broken right after the opening
#' parenthesis.
#' @inheritParams set_line_break_if_call_is_multi_line
#' @param pd A parse table.
#' @keywords internal
find_line_break_position_in_multiline_call <- function(pd) {
candidate <- (which(pd$token == "EQ_SUB") - 1L)[1L]
Expand Down Expand Up @@ -377,7 +375,8 @@ set_line_break_before_closing_call <- function(pd, except_token_before) {
}


#' @rdname set_line_break_if_call_is_multi_line
#' @describeIn set_line_break_if_call_is_multi_line Remove line breaks in
#' function calls.
#' @keywords internal
remove_line_break_in_fun_call <- function(pd, strict) {
if (is_function_call(pd)) {
Expand Down
2 changes: 1 addition & 1 deletion R/set-assert-args.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set_arg_write_tree <- function(write_tree) {
#' @inheritParams make_transformer
#' @keywords internal
assert_transformers <- function(transformers) {
version_cutoff <- 2.0
version_cutoff <- "2.0"
no_name <- is.null(transformers$style_guide_name)
no_version <- is.null(transformers$style_guide_version)
if (no_name || no_version) {
Expand Down
2 changes: 1 addition & 1 deletion R/testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ local_test_setup <- function(cache = FALSE,
.local_envir = parent.frame()) {
current_cache <- cache_info(format = "tabular")
withr::local_options(
list("styler.quiet" = TRUE, "R.cache.rootPath" = tempfile()),
list(styler.quiet = TRUE, R.cache.rootPath = tempfile()),
.local_envir = .local_envir
)
if (cache) {
Expand Down
9 changes: 5 additions & 4 deletions R/transform-files.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ make_transformer <- function(transformers,
use_cache <- FALSE
}

if (!use_cache) {
if (use_cache) {
text
} else {
transformed_code <- text %>%
parse_transform_serialize_r(transformers,
parse_transform_serialize_r(
transformers,
base_indention = base_indention,
warn_empty = warn_empty
)
Expand All @@ -139,8 +142,6 @@ make_transformer <- function(transformers,
}

transformed_code
} else {
text
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions R/ui-caching.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ cache_info <- function(cache_name = NULL, format = "both") {
#' @export
cache_activate <- function(cache_name = NULL,
verbose = !getOption("styler.quiet", FALSE)) {
options("styler.cache_name" = cache_name %||% styler_version)
options(styler.cache_name = cache_name %||% styler_version)
path <- cache_find_path(cache_name)

if (verbose) {
Expand All @@ -155,7 +155,7 @@ cache_activate <- function(cache_name = NULL,
#' @rdname cache_activate
#' @export
cache_deactivate <- function(verbose = !getOption("styler.quiet", FALSE)) {
options("styler.cache_name" = NULL)
options(styler.cache_name = NULL)

if (verbose) {
cat("Deactivated cache.\n")
Expand Down
4 changes: 2 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ editor_options:
wrap: 79
---

This is a release requested by the CRAN team to delete the population of the
user's cache while building vignettes.
This is a release requested by the CRAN team to comply with
`R_CHECK_STOP_ON_INVALID_NUMERIC_VERSION_INPUTS`.


## Test environments
Expand Down
2 changes: 0 additions & 2 deletions man/is_insufficiently_parsed_string.Rd

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

11 changes: 11 additions & 0 deletions man/set_line_break_after_opening_if_call_is_multi_line.Rd

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

16 changes: 5 additions & 11 deletions man/set_line_break_if_call_is_multi_line.Rd

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

2 changes: 0 additions & 2 deletions tests/testthat/test-create_token.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("can create a token that has relevant columns", {
pd_names <- c(
"token", "text", "short", "lag_newlines", "newlines", "pos_id",
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-create_tree.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("create_trees outputs identical structure if trees have same structure", {
skip_if_not_installed("DiagrammeR")
skip_if_not_installed("data.tree")
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-curly-curly.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("curly-culry", {
expect_warning(test_collection("curly-curly",
"mixed",
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-exception_handling.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("style_text returns custom error", {
expect_error(style_text("a <- 3 4"), "unexpected numeric constant")
})
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-helpers.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("can construct and print vertical", {
skip_if_not_installed("prettycode")
expect_snapshot({
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-identify-roxygen-examples.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#' Things to consider:
#' * one function declaration or many
#' * example(s) is last tag or not?
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-indention_curly.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("indention on one-liner curley only is not changed", {
expect_warning(test_collection("indention_curly_brackets",
"one_line_curly",
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-indention_fun_calls.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("edge cases work", {
expect_warning(test_collection("indention_fun_calls",
transformer = style_text, strict = FALSE
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-indention_multiple.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("multiple round brackets don't cause extraindention", {
expect_warning(test_collection("indention_multiple",
"round_only",
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-indention_operators.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("pipe is indended correctly", {
expect_warning(test_collection("indention_operators",
"pipe",
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-indention_round_brackets.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


test_that("one-line function call yields correct indention", {
expect_warning(test_collection("indention_round_brackets",
"one_line",
Expand Down
Loading

0 comments on commit 30e8f15

Please sign in to comment.