Skip to content

Commit 4b24ff6

Browse files
Merge pull request #1197 from r-lib/r-440
2 parents f5744da + ed8b058 commit 4b24ff6

13 files changed

+18
-30
lines changed

.github/workflows/check-full.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ jobs:
2020
config:
2121
- {os: macos-latest, r: 'release'}
2222

23+
- {os: windows-latest, r: 'devel'}
2324
- {os: windows-latest, r: 'release'}
24-
# Use 3.6 to trigger usage of RTools35
25-
- {os: windows-latest, r: '3.6'}
2625
# use 4.1 to check with rtools40's older compiler
2726
- {os: windows-latest, r: '4.1'}
2827

@@ -56,7 +55,7 @@ jobs:
5655
- uses: r-lib/actions/check-r-package@v2
5756
with:
5857
upload-snapshots: true
59-
error-on: 'ifelse(getRversion() > "3.6", "warning", "note")'
58+
error-on: '"note"'
6059
env:
6160
_R_CHECK_FORCE_SUGGESTS_: false
6261
_R_CHECK_STOP_ON_INVALID_NUMERIC_VERSION_INPUTS_: true

.lintr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ linters: linters_with_tags(
88
line_length_linter(120L),
99
namespace_linter = NULL,
1010
nested_ifelse_linter = NULL,
11-
# TODO: remove this once the lint message is fixed
1211
nzchar_linter = NULL,
1312
object_name_linter = NULL,
1413
object_length_linter(70L),
1514
object_overwrite_linter = NULL,
1615
object_usage_linter = NULL,
1716
todo_comment_linter = NULL,
18-
extraction_operator_linter = NULL,
1917
nonportable_path_linter = NULL,
2018
string_boundary_linter = NULL,
2119
undesirable_function_linter = NULL,

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ repos:
2323
- id: lintr
2424
additional_dependencies:
2525
- r-lib/lintr
26+
- any::cyclocomp
2627
exclude: >
2728
(?x)^(
2829
inst/.*|

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ License: MIT + file LICENSE
2323
URL: https://github.com/r-lib/styler, https://styler.r-lib.org
2424
BugReports: https://github.com/r-lib/styler/issues
2525
Depends:
26-
R (>= 3.6.0)
26+
R (>= 4.0.0)
2727
Imports:
2828
cli (>= 3.1.1),
2929
magrittr (>= 2.0.0),

R/addins.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ style_active_file <- function() {
7272
}
7373
rstudioapi::modifyRange(
7474
c(1L, 1L, length(context$contents) + 1L, 1L),
75-
paste0(ensure_last_n_empty(out), collapse = "\n"),
75+
paste(ensure_last_n_empty(out), collapse = "\n"),
7676
id = context$id
7777
)
7878
if (save_after_styling_is_active() && context$path != "") {
@@ -132,7 +132,7 @@ style_selection <- function() {
132132
)
133133
rstudioapi::modifyRange(
134134
context$selection[[1L]]$range,
135-
paste0(c(
135+
paste(c(
136136
out,
137137
if (context$selection[[1L]]$range$end[2L] == 1L) ""
138138
), collapse = "\n"),

R/detect-alignment-utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ alignment_serialize <- function(pd_sub) {
161161
if (anyNA(out)) {
162162
return(NA)
163163
}
164-
paste0(out, collapse = "")
164+
paste(out, collapse = "")
165165
}
166166

167167
#' Check if spacing around comma is correct

R/environments.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
#' * `parser_version_find()` determines the version of the parser from parse
2727
#' data. This does not necessarily mean that the version found is the
2828
#' actual version, but it *behaves* like it. For example, code that does not
29-
#' contain `EQ_ASSIGN` is parsed the same way with version 1 and 2. If the
30-
#' behavior is identical, the version is set to 1.
29+
#' contain `EQ_ASSIGN` is parsed the same way with version `1` and `2`. If the
30+
#' behavior is identical, the version is set to `1`. Since the package now
31+
#' requires R >= 4.0, the version is always set to `3`.
3132
#' @param version The version of the parser to be used.
3233
#' @param pd A parse table such as the output from
3334
#' `utils::getParseData(parse(text = text))`.
@@ -42,10 +43,7 @@ parser_version_get <- function() {
4243
}
4344

4445
#' @rdname parser_version_set
45-
parser_version_find <- function(pd) {
46-
if (any(pd$token == "equal_assign")) 2L else 3L
47-
}
48-
46+
parser_version_find <- function(pd) 3L
4947

5048
#' The elements that are added to this environment are:
5149
#'

R/parse.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ tokenize <- function(text) {
8787
#' @param ... Other arguments passed to [utils::getParseData()].
8888
#' @keywords internal
8989
get_parse_data <- function(text, include_text = TRUE, ...) {
90-
# avoid https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16041
91-
parse_safely(text, keep.source = TRUE)
9290
parsed <- parse_safely(text, keep.source = TRUE)
9391
pd <- utils::getParseData(parsed, includeText = include_text) %>%
9492
styler_df()

R/roxygen-examples-parse.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ parse_roxygen <- function(roxygen) {
6868
roxygen_remove_extra_brace <- function(parsed) {
6969
parsed <- rlang::try_fetch(
7070
{
71-
parse(text = paste0(gsub("^\\\\[[:alpha:]]*", "", parsed), collapse = ""))
71+
parse(text = paste(gsub("^\\\\[[:alpha:]]*", "", parsed), collapse = ""))
7272
parsed
7373
},
7474
error = function(e) {

R/style-guides.R

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,6 @@ tidyverse_style <- function(scope = "tokens",
226226
tokens = list(
227227
resolve_semicolon = "';'",
228228
add_brackets_in_pipe = c("SPECIAL-PIPE", "PIPE"),
229-
# before 3.6, these assignments are not wrapped into top-level expression
230-
# and `text` supplied to transformers_drop() is "", so it appears to not
231-
# contain EQ_ASSIGN, and the transformer is falsely removed.
232-
# compute_parse_data_nested / text_to_flat_pd ('a = 4')
233229
force_assignment_op = "EQ_ASSIGN",
234230
wrap_if_else_while_for_fun_multi_line_in_curly = c(
235231
"IF", "WHILE", "FOR", "FUNCTION"

0 commit comments

Comments
 (0)