Skip to content

Commit d8104a0

Browse files
committed
chore: Reformat with latest air
1 parent ab592b2 commit d8104a0

6 files changed

Lines changed: 20 additions & 16 deletions

File tree

R/fix.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ fix <- function(
6464
interactive = FALSE
6565
) {
6666
if (isFALSE(verbose) | is_testing()) {
67-
withr::local_options(cli.default_handler = function(...) {
68-
})
67+
withr::local_options(cli.default_handler = function(...) {})
6968
}
7069

7170
if (isTRUE(interactive)) {

R/lint.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ lint <- function(
9696
verbose = TRUE
9797
) {
9898
if (isFALSE(verbose) | is_testing()) {
99-
withr::local_options(cli.default_handler = function(...) {
100-
})
99+
withr::local_options(cli.default_handler = function(...) {})
101100
}
102101

103102
if (is_testing()) {

R/review_app.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ review_app <- function(name, old_path, new_path) {
6161
}
6262
remaining <- case_index[!handled]
6363
next_cases <- which(remaining > i())
64-
if (length(next_cases) == 0) remaining[[1]] else
64+
if (length(next_cases) == 0) {
65+
remaining[[1]]
66+
} else {
6567
remaining[[next_cases[[1]]]]
68+
}
6669
}
6770
}
6871
rlang::inform(c(

tests/spelling.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
if (requireNamespace('spelling', quietly = TRUE))
1+
if (requireNamespace('spelling', quietly = TRUE)) {
22
spelling::spell_check_test(
33
vignettes = TRUE,
44
error = FALSE,
55
skip_on_cran = TRUE
66
)
7+
}

tests/testthat/test-seq.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ test_that("seq_len(...) or seq_along(...) expressions are fine", {
1818

1919
test_that("finds seq(...) expressions", {
2020
linter <- seq_linter()
21-
lint_msg <- function(want, got)
21+
lint_msg <- function(want, got) {
2222
paste0(
2323
got,
2424
" is likely to be wrong in the empty edge case. Use ",
2525
want,
2626
" instead"
2727
)
28+
}
2829

2930
expect_lint(
3031
"seq(length(x))",
@@ -53,13 +54,14 @@ test_that("finds seq(...) expressions", {
5354

5455
test_that("finds 1:length(...) expressions", {
5556
linter <- seq_linter()
56-
lint_msg <- function(want, got)
57+
lint_msg <- function(want, got) {
5758
paste0(
5859
got,
5960
" is likely to be wrong in the empty edge case. Use ",
6061
want,
6162
" instead"
6263
)
64+
}
6365

6466
expect_lint(
6567
"1:length(x)",

vignettes/automatic_fixes.Rmd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ knitr::opts_chunk$set(
1818
library(flir)
1919
```
2020

21-
The main feature of `flir` is that it can provide automatic fixes for some linters.
21+
The main feature of `flir` is that it can provide automatic fixes for some linters.
2222
This is very useful to avoid the tedious job of fixing many files by hand but you may be worried about it applying wrong fixes.
2323
Moreover, since those fixes can be applied to several files at once, going back in time before those fixes were applied can be very difficult.
2424
`flir` provides two mechanisms to be more confident about automated fixes.
2525

2626
## Use Git
2727

28-
By default, if `flir` would automatically fix several files and the project doesn't use Git for version control, a menu will appear recommending you to use Git.
28+
By default, if `flir` would automatically fix several files and the project doesn't use Git for version control, a menu will appear recommending you to use Git.
2929
At this stage, you can still decide whether you want to apply the fixes or stop here without changing anything.
3030

31-
Git makes it much easier to see changed files and it is therefore very recommended to use it in combination with `flir`.
32-
Similarly, if some files are unstaged (meaning that they have changes not covered by Git yet), another menu will ask you to confirm that you want to apply fixes.
31+
Git makes it much easier to see changed files and it is therefore very recommended to use it in combination with `flir`.
32+
Similarly, if some files are unstaged (meaning that they have changes not covered by Git yet), another menu will ask you to confirm that you want to apply fixes.
3333
The reason is that for those unstaged files, it may be difficult to distinguish the new changes introduced by automated fixes from previous, unsaved changes.
3434

3535
## Interactively review all fixes
3636

37-
Whether you use Git or not, you can also opt in for interactive review of changes using the `interactive` parameter in most of the `fix_*()` functions.
38-
Setting `interactive = TRUE` will open a Shiny application enabling you to see all the changes that *would be* introduced by `flir`.
39-
Those changes are not applied yet: you can decide whether you want to apply them or to skip them.
37+
Whether you use Git or not, you can also opt in for interactive review of changes using the `interactive` parameter in most of the `fix_*()` functions.
38+
Setting `interactive = TRUE` will open a Shiny application enabling you to see all the changes that *would be* introduced by `flir`.
39+
Those changes are not applied yet: you can decide whether you want to apply them or to skip them.
4040
If you have several files to review, accepting or skipping the changes for one file will automatically go to the next file.
4141

42-
The video below shows that I have two files, `foo1.R` and `foo2.R`, both of which would be modified by automated fixes.
42+
The video below shows that I have two files, `foo1.R` and `foo2.R`, both of which would be modified by automated fixes.
4343
Using `interactive = TRUE` allows me to decide whether I actually want fixes to be applied or not:
4444

4545
![A gif showing `fix()` applied on two files and opening a Shiny app to review changes. Changes for the first file are accepted but not those for the second file. Only the first file is modified.](demo.gif)

0 commit comments

Comments
 (0)