Skip to content

Commit aa1a2ed

Browse files
fix styler
1 parent a3b4257 commit aa1a2ed

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

inst/hooks/exported/style-files.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ if (packageVersion("styler") < "1.3.2") {
4646
} else {
4747
precommit::may_require_permanent_cache(arguments$no_warn_cache)
4848
}
49-
options('styler.cache_root' = arguments$cache_root)
50-
print(c('cache root set to ', arguments$cache_root))
49+
options("styler.cache_root" = arguments$cache_root)
50+
print(c("cache root set to ", arguments$cache_root))
5151

5252
style <- eval(parse(text = paste(arguments$style_pkg, "::", arguments$style_fun)))
5353
tryCatch(

tests/testthat/test-hooks.R

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,37 @@ run_test("use-tidy-description", "DESCRIPTION", suffix = "")
88
### style-files ####
99

1010
# success
11-
run_test("style-files",
12-
suffix = "-success.R", cmd_args = c('--cache-root=styler')
11+
run_test("style-files",
12+
suffix = "-success.R", cmd_args = c("--cache-root=styler")
1313
)
1414
# fail
1515
run_test("style-files",
16-
suffix = "-fail-changed.R", cmd_args = c('--cache-root=styler'),
17-
error_msg = NA)
16+
suffix = "-fail-changed.R", cmd_args = c("--cache-root=styler"),
17+
error_msg = NA
18+
)
1819

19-
run_test("style-files", suffix = "-fail-parse.R", cmd_args = c('--cache-root=styler'),
20-
error_msg = "unexpected")
20+
run_test("style-files",
21+
suffix = "-fail-parse.R", cmd_args = c("--cache-root=styler"),
22+
error_msg = "unexpected"
23+
)
2124

2225
# success with cmd args
2326
run_test("style-files",
2427
file_name = "style-files-cmd",
2528
suffix = "-success.R",
26-
cmd_args = c("--style_pkg=styler", "--style_fun=tidyverse_style", '--cache-root=styler')
29+
cmd_args = c("--style_pkg=styler", "--style_fun=tidyverse_style", "--cache-root=styler")
2730
)
2831

2932
run_test("style-files",
3033
file_name = "style-files-cmd",
3134
suffix = "-success.R",
32-
cmd_args = c("--scope=spaces", '--cache-root=styler')
35+
cmd_args = c("--scope=spaces", "--cache-root=styler")
3336
)
3437

3538
run_test("style-files",
3639
file_name = "style-files-cmd",
3740
suffix = "-success.R",
38-
cmd_args = c('--scope="I(\'spaces\')"', '--cache-root=styler')
41+
cmd_args = c('--scope="I(\'spaces\')"', "--cache-root=styler")
3942
)
4043

4144
run_test("style-files",
@@ -44,8 +47,8 @@ run_test("style-files",
4447
cmd_args = c(
4548
'--scope="I(\'spaces\')"',
4649
"--base_indention=0",
47-
"--include_roxygen_examples=TRUE",
48-
'--cache-root=styler'
50+
"--include_roxygen_examples=TRUE",
51+
"--cache-root=styler"
4952
)
5053
)
5154

@@ -56,37 +59,37 @@ run_test("style-files",
5659
'--scope="I(\'spaces\')"',
5760
"--base_indention=0",
5861
"--include_roxygen_examples=TRUE",
59-
'--reindention="specify_reindention(\'#\')"',
60-
'--cache-root=styler'
62+
'--reindention="specify_reindention(\'#\')"',
63+
"--cache-root=styler"
6164
)
6265
)
6366

6467
run_test("style-files",
6568
file_name = "style-files",
6669
suffix = "-base-indention-success.R",
67-
cmd_args = c("--base_indention=4", '--cache-root=styler')
70+
cmd_args = c("--base_indention=4", "--cache-root=styler")
6871
)
6972

7073
run_test("style-files",
7174
file_name = "style-files",
7275
suffix = "-roxygen-success.R",
73-
cmd_args = c("--include_roxygen_examples=FALSE", '--cache-root=styler')
76+
cmd_args = c("--include_roxygen_examples=FALSE", "--cache-root=styler")
7477
)
7578

7679
# fail with cmd args
7780
run_test("style-files",
7881
file_name = "style-files-cmd",
7982
suffix = "-success.R",
8083
error_msg = "scope must be one",
81-
cmd_args = c("--scope=space", '--cache-root=styler')
84+
cmd_args = c("--scope=space", "--cache-root=styler")
8285
)
8386

8487
run_test("style-files",
8588
file_name = "style-files-cmd",
8689
suffix = "-fail.R",
8790
error_msg = NA,
8891
cmd_args = c(
89-
"--style_pkg=styler", "--style_fun=tidyverse_style", '--cache-root=styler'
92+
"--style_pkg=styler", "--style_fun=tidyverse_style", "--cache-root=styler"
9093
)
9194
)
9295

tests/testthat/test-zzz.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
test_that("tests don't write to styler-perm", {
22
skip_on_cran()
33
expect_false(fs::file_exists(
4-
fs::path(R.cache::getCacheRootPath(), "styler-perm")
5-
)
6-
)
4+
fs::path(R.cache::getCacheRootPath(), "styler-perm")
5+
))
76
})

0 commit comments

Comments
 (0)