You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
delete function_brace_linter and merge it into brace_linter (#1094)
* delete function_brace_linter and merge it into brace_linter
* delete if_else_match_braces_linter and merge it into brace_linter (#1095)
* delete if_else_match_braces_linter and merge it into brace_linter
* deprecate open_curly_linter and merge it into brace_linter (#1096)
* deprecate open_curly_linter
- remove open_curly_linter from defaults
- refactor to XPath based approach
- no longer lint trailing whitespace (there's a separate linter for that)
* merge paren_brace_linter into brace_linter (#1097)
* deprecate paren_brace_linter
- remove paren_brace_linter from defaults
- extend to else{ and repeat{
* `code`
Co-authored-by: Michael Chirico <[email protected]>
* add explicit test for different behaviour compared to closed_curly_linter
Co-authored-by: Michael Chirico <[email protected]>
Co-authored-by: Michael Chirico <[email protected]>
Co-authored-by: Michael Chirico <[email protected]>
Copy file name to clipboardExpand all lines: NEWS.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,11 @@
11
11
* Rename `semicolon_terminator_linter` to `semicolon_linter` for better consistency. `semicolon_terminator_linter` survives but is marked for deprecation. The new linter also has a new signature, taking arguments `allow_compound` and `allow_trailing` to replace the old single argument `semicolon=`, again for signature consistency with other linters.
12
12
* Combined several curly brace related linters into a new `brace_linter` (#1041, @AshesITR):
13
13
+`closed_curly_linter()`
14
+
+`open_curly_linter()`, no longer linting unnecessary trailing whitespace
15
+
+`paren_brace_linter()`, also linting `if`/`else` and `repeat` with missing whitespace
14
16
+ Require `else` to come on the same line as the preceding `}`, if present (#884, @michaelchirico)
17
+
+ Require functions spanning multiple lines to use curly braces (@michaelchirico)
18
+
+ Require balanced usage of `{}` in `if`/`else` conditions (@michaelchirico)
15
19
* The `...` arguments for `lint()`, `lint_dir()`, and `lint_package()` have promoted to an earlier position to better match the [Tidyverse design principal](https://design.tidyverse.org/args-data-details.html) of data->descriptor->details. This change enables passing objects to `...` without needing to specify non-required arguments, e.g. `lint_dir("/path/to/dir", linter())` now works without the need to specify `relative_path`. This affects some code that uses positional arguments. (#935, @michaelchirico)
16
20
+ For `lint()`, `...` is now the 3rd argument, where earlier this was `cache=`
17
21
+ For `lint_dir()` and `lint_package()`, `...` is now the 2nd argument, where earlier this was `relative_path=`
@@ -117,7 +121,6 @@ function calls. (#850, #851, @renkun-ken)
117
121
*`yoda_test_linter()` Require usage of `expect_identical(x, 1L)` over `expect_equal(1L, x)` and similar
118
122
*`expect_identical_linter()` Require usage of `expect_identical()` by default, and `expect_equal()` only by exception
119
123
*`expect_comparison_linter()` Require usage of `expect_gt(x, y)` over `expect_true(x > y)` and similar
120
-
*`if_else_match_braces_linter()` Require balanced usage of `{}` in `if`/`else` conditions
121
124
*`vector_logic_linter()` Require use of scalar logical operators (`&&` and `||`) inside `if()` conditions and similar
122
125
*`any_is_na_linter()` Require usage of `anyNA(x)` over `any(is.na(x))`
123
126
*`class_equals_linter()` Prevent comparing `class(x)` with `==`, `!=`, or `%in%`, where `inherits()` is typically preferred
@@ -131,7 +134,10 @@ function calls. (#850, #851, @renkun-ken)
131
134
*`nested_ifelse_linter()` Prevent nested calls to `ifelse()` like `ifelse(A, x, ifelse(B, y, z))`, and similar
132
135
*`condition_message_linter` Prevent condition messages from being constructed like `stop(paste(...))` (where just `stop(...)` is preferable)
133
136
*`redundant_ifelse_linter()` Prevent usage like `ifelse(A & B, TRUE, FALSE)` or `ifelse(C, 0, 1)` (the latter is `as.numeric(!C)`)
134
-
*`brace_linter()` Require `else` to come on the same line as the preceding `}`, if present
137
+
* Extensions to `brace_linter()`
138
+
+ Require `else` to come on the same line as the preceding `}`, if present
139
+
+ Require balanced usage of `{}` in `if`/`else` conditions
140
+
+ Require functions spanning multiple lines to use curly braces
135
141
*`unreachable_code_linter()` Prevent code after `return()` and `stop()` statements that will never be reached (extended for #1051 thanks to early user testing, thanks @bersbersbers!)
136
142
*`regex_subset_linter()` Require usage of `grep(ptn, x, value = TRUE)` over `x[grep(ptn, x)]` and similar
137
143
*`consecutive_stopifnot_linter()` Require consecutive calls to `stopifnot()` to be unified into one
0 commit comments