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
* Create cbind_dataframe_linter()
Fix#2596
* Rename linter to list2df_linter()
* Ensure symmetry in examples
* Remove unnecessary "if available" in msg
* Refactor linter without make_linter_from_xpath()
* Detect functions passed as string
* Fix lints
* Re-document
* refine wording+docs
* Add test for anonymous function
* Use stricter xpath to avoid get_r_string() on false positives
* Add extra !is.na() safety to avoid NA in unanticipated complex xpaths
* Add anonymous function expr to vectorized test
* Revert to xml_find_function_calls() approach
* Land on parent::expr
* Use xml_parent() instead of xml_find_all()
* Add NEWS bullet
* Add column_number to tests to ensure lints lands where expected
Co-authored-by: Michael Chirico <chiricom@google.com>
---------
Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
Co-authored-by: Michael Chirico <chiricom@google.com>
Copy file name to clipboardExpand all lines: NEWS.md
+25-24
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@
33
33
34
34
### New linters
35
35
36
+
*`lint2df_linter()` encourages the use of the `list2DF()` function, or the `data.frame()` function when recycling is required, over the slower and less readable `do.call(cbind.data.frame, )` alternative (#2834, @Bisaloo).
36
37
*`coalesce_linter()` encourages the use of the infix operator `x %||% y`, which is equivalent to `if (is.null(x)) y else x` (#2246, @MichaelChirico). While this has long been used in many tidyverse packages (it was added to {ggplot2} in 2008), it became part of every R installation from R 4.4.0.
37
38
38
39
### Lint accuracy fixes: removing false positives
@@ -304,7 +305,7 @@
304
305
305
306
## Bug fixes
306
307
307
-
*`linters_with_tags()` now includes the previously missing spaces around "and" when listing missing linters advertised by `available_linters()`.
308
+
*`linters_with_tags()` now includes the previously missing spaces around "and" when listing missing linters advertised by `available_linters()`.
308
309
This error message may appear e.g. when you update lintr to a version with new linters but don't restart your R session (#1946, @Bisaloo)
309
310
310
311
*`fixed_regex_linter()` is more robust to errors stemming from unrecognized escapes (#1545, #1845, @IndrajeetPatil).
@@ -358,7 +359,7 @@
358
359
the style guide on handling this case awaits clarification: https://github.com/tidyverse/style/issues/191.
359
360
(#1346, @MichaelChirico)
360
361
361
-
*`undesirable_function_linter()` and `undesirable_operator_linter()` now produce an error
362
+
*`undesirable_function_linter()` and `undesirable_operator_linter()` now produce an error
362
363
if empty vector of undesirable functions or operators is provided (#1867, @IndrajeetPatil).
363
364
364
365
* New linters which are also included as defaults (see "New linters" for more details):
@@ -412,7 +413,7 @@
412
413
413
414
*`all_linters()` function provides an easy way to access all available linters (#1843, @IndrajeetPatil)
414
415
415
-
*`missing_argument_linter()` allows missing arguments in `quote()` calls (#1889, @IndrajeetPatil).
416
+
*`missing_argument_linter()` allows missing arguments in `quote()` calls (#1889, @IndrajeetPatil).
416
417
417
418
*`get_source_expressions()` correctly extracts indented code chunks from R Markdown documents, which helps avoid spurious lints related to whitespace (#1945, @MichaelChirico). The convention taken is that, within each chunk, all code is anchored relative to the leftmost non-whitespace column.
418
419
@@ -453,7 +454,7 @@
453
454
454
455
*`indentation_linter()` for checking that the indentation conforms to 2-space Tidyverse-style (@AshesITR and @dgkf, #1411, #1792, #1898).
455
456
456
-
*`unnecessary_nested_if_linter()` for checking unnecessary nested `if` statements where a single
457
+
*`unnecessary_nested_if_linter()` for checking unnecessary nested `if` statements where a single
457
458
`if` statement with appropriate conditional expression would suffice (@IndrajeetPatil and @AshesITR, #1778).
458
459
459
460
*`implicit_assignment_linter()` for checking implicit assignments in function calls (@IndrajeetPatil and @AshesITR, #1777).
@@ -474,17 +475,17 @@
474
475
`marginformat` from {tufte} or `theorem` from {bookdown}, note that those engines must be registered
475
476
in {knitr} prior to running `lint()` in order for {lintr} to behave as expected, i.e., they should be
476
477
shown as part of `knitr::knit_engines$get()`.
477
-
478
+
478
479
For {tufte} and {bookdown} in particular, one only needs to load the package namespace to accomplish
479
480
this (i.e., minimally `loadNamespace("tufte")` or `loadNamespace("bookdown")`, respectively, will
480
481
register those packages' custom engines; since `library()` also runs `loadNamespace()`, running
481
482
`library()` will also work). Note further that {tufte} only added this code to their `.onLoad()` recently
482
483
after our request to do so (see https://github.com/rstudio/tufte/issues/117). Therefore, ensure you're using a
483
484
more recent version to get the behavior described here for {tufte}.
484
-
485
+
485
486
More generally, there is no requirement that `loadNamespace()` will register a package's custom {knitr}
486
487
engines, so you may need to work with other package authors to figure out a solution for other engines.
487
-
488
+
488
489
Thanks to Yihui and other developers for their helpful discussions around this issue (#797, @IndrajeetPatil).
489
490
490
491
* The output of `lint()` and `Lint()` gain S3 class `"list"` to assist with S3 dispatch (#1494, @MichaelChirico)
@@ -509,23 +510,23 @@ works when passed to the `styles` parameter (#1924, @hedsnz).
509
510
510
511
## Changes to defaults
511
512
512
-
*`brace_linter()` allows opening curly braces on a new line when there is
513
+
*`brace_linter()` allows opening curly braces on a new line when there is
513
514
a comment ending the preceding line (#1433 and #1434, @IndrajeetPatil).
514
515
515
-
*`seq_linter()` produces lint for `seq(...)`, since it also cannot properly
516
+
*`seq_linter()` produces lint for `seq(...)`, since it also cannot properly
516
517
handle empty edge cases (#1468, @IndrajeetPatil).
517
518
518
-
*`seq_linter()` additionally lints on `1:n()` (from {dplyr})
519
+
*`seq_linter()` additionally lints on `1:n()` (from {dplyr})
519
520
and `1:.N` (from {data.table}) (#1396, @IndrajeetPatil).
0 commit comments