diff --git a/dev/articles/creating_linters.html b/dev/articles/creating_linters.html index 8b7c1e968..18b1088a9 100644 --- a/dev/articles/creating_linters.html +++ b/dev/articles/creating_linters.html @@ -87,7 +87,7 @@
vignettes/creating_linters.Rmd
creating_linters.Rmd
You can include tag-based linters in the configuration file, and customize them further:
linters: linters_with_tags(
@@ -599,11 +598,11 @@ Using all available linters#> [99] "todo_comment_linter" "trailing_blank_lines_linter"
#> [101] "trailing_whitespace_linter" "undesirable_function_linter"
#> [103] "undesirable_operator_linter" "unnecessary_concatenation_linter"
-#> [105] "unnecessary_lambda_linter" "unnecessary_nested_if_linter"
-#> [107] "unnecessary_nesting_linter" "unnecessary_placeholder_linter"
-#> [109] "unreachable_code_linter" "unused_import_linter"
-#> [111] "vector_logic_linter" "which_grepl_linter"
-#> [113] "whitespace_linter" "yoda_test_linter"
If you want to use all available linters, you can include this in
your .lintr
file:
linters: all_linters()
extraction_operator_linter()
is deprecated. Although switching from $
to [[
has some robustness benefits for package code, it can lead to non-idiomatic code in many contexts (e.g. R6 classes, Shiny applications, etc.) (#2409, @IndrajeetPatil). To enable the detection of the $
operator for extraction through partial matching, use options(warnPartialMatchDollar = TRUE)
.unnecessary_nested_if_linter()
is deprecated and subsumed into the new/more general unnecessary_nesting_linter()
.unnecessary_placeholder_linter()
for identifying where usage of the {magrittr} placeholder .
could be omitted (@MichaelChirico)
routine_registration_linter()
for identifying native routines that don’t use registration (useDynLib
in the NAMESPACE
; @MichaelChirico)
indentation_linter()
for checking that the indentation conforms to 2-space Tidyverse-style (@AshesITR and @dgkf, #1411, #1792, #1898).
unnecessary_nested_if_linter()
for checking unnecessary nested if
statements where a single if
statement with appropriate conditional expression would suffice (@IndrajeetPatil and @AshesITR, #1778).
unnecessary_nested_if_linter()
for checking unnecessary nested if
statements where a single if
statement with appropriate conditional expression would suffice (@IndrajeetPatil and @AshesITR, #1778).
implicit_assignment_linter()
for checking implicit assignments in function calls (@IndrajeetPatil and @AshesITR, #1777).
quotes_linter()
is a generalized version of (now deprecated) single_quotes_linter()
. It accepts an argument delimiter
to specify whether "
or '
should be the accepted method for delimiting character literals. The default, "
, reflects the Tidyverse style guide recommendation and matches the behavior of single_quotes_linter()
.
unnecessary_concatenation_linter()
is simply unneeded_concatenation_linter()
, renamed.
tmp <- withr::local_tempfile(lines = "c('a', 'b')")
expr_as_xml <- get_source_expressions(tmp)$expressions[[1L]]$xml_parsed_content
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c5c5402a0': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed719a0c8c': No such file or directory
#> Error in file(con, "r"): cannot open the connection
writeLines(as.character(expr_as_xml))
#> Error in eval(expr, envir, enclos): object 'expr_as_xml' not found
@@ -118,7 +118,7 @@ Examples# more importantly, extract strings under R>=4 raw strings
tmp4.0 <- withr::local_tempfile(lines = "c(R'(a\\b)', R'--[a\\\"\'\"\\b]--')")
expr_as_xml4.0 <- get_source_expressions(tmp4.0)$expressions[[1L]]$xml_parsed_content
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c24810c16': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed1e62d0db': No such file or directory
#> Error in file(con, "r"): cannot open the connection
writeLines(as.character(expr_as_xml4.0))
#> Error in eval(expr, envir, enclos): object 'expr_as_xml4.0' not found
diff --git a/dev/reference/get_source_expressions.html b/dev/reference/get_source_expressions.html
index 25f2b7aa6..5b8236222 100644
--- a/dev/reference/get_source_expressions.html
+++ b/dev/reference/get_source_expressions.html
@@ -136,7 +136,7 @@ Details
Examples
tmp <- withr::local_tempfile(lines = c("x <- 1", "y <- x + 1"))
get_source_expressions(tmp)
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c15506c7': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed629f2edc': No such file or directory
#> Error in file(con, "r"): cannot open the connection
tmp <- withr::local_tempfile(lines = c("x <- 1", "y <- x + 1"))
source_exprs <- get_source_expressions(tmp)
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c6542599b': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed28a1189e': No such file or directory
#> Error in file(con, "r"): cannot open the connection
ids_with_token(source_exprs$expressions[[1L]], value = "SYMBOL")
#> Error in eval(expr, envir, enclos): object 'source_exprs' not found
diff --git a/dev/reference/index.html b/dev/reference/index.html
index f850d7aa2..759cf88f4 100644
--- a/dev/reference/index.html
+++ b/dev/reference/index.html
@@ -650,11 +650,6 @@ Individual lintersunnecessary_nested_if_linter()
-
-
if
conditional statementsunnecessary_nesting_linter()
tmp <- withr::local_tempfile(lines = c("x <- 1", "y <- x + 1"))
source_exprs <- get_source_expressions(tmp)
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c7a8d5089': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed3d97a75a': No such file or directory
#> Error in file(con, "r"): cannot open the connection
is_lint_level(source_exprs$expressions[[1L]], level = "expression")
#> Error in eval(expr, envir, enclos): object 'source_exprs' not found
diff --git a/dev/reference/lint.html b/dev/reference/lint.html
index 95d918f70..a1500a3f4 100644
--- a/dev/reference/lint.html
+++ b/dev/reference/lint.html
@@ -191,7 +191,7 @@ Details
Examples
f <- withr::local_tempfile(lines = "a=1", fileext = "R")
lint(f) # linting a file
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c7a25235cR': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed40ca6363R': No such file or directory
#> Error in file(con, "r"): cannot open the connection
lint("a = 123\n") # linting inline-code
#> ::warning file=<text>,line=1,col=3::file=<text>,line=1,col=3,[assignment_linter] Use <-, not =, for assignment.
diff --git a/dev/reference/linters.html b/dev/reference/linters.html
index d7c308fdb..05a2757ed 100644
--- a/dev/reference/linters.html
+++ b/dev/reference/linters.html
@@ -93,12 +93,12 @@ Tags
consistency (32 linters)
correctness (7 linters)
default (26 linters)
-deprecated (5 linters)
+deprecated (6 linters)
efficiency (32 linters)
executing (6 linters)
package_development (14 linters)
pkg_testthat (12 linters)
-readability (65 linters)
+readability (64 linters)
regex (4 linters)
robustness (17 linters)
style (40 linters)
@@ -211,8 +211,7 @@ Linters
undesirable_operator_linter
(tags: best_practices, configurable, efficiency, robustness, style)
unnecessary_concatenation_linter
(tags: configurable, efficiency, readability, style)
unnecessary_lambda_linter
(tags: best_practices, configurable, efficiency, readability)
-unnecessary_nested_if_linter
(tags: best_practices, readability)
-unnecessary_nesting_linter
(tags: configurable, consistency, readability)
+unnecessary_nesting_linter
(tags: best_practices, configurable, consistency, readability)
unnecessary_placeholder_linter
(tags: best_practices, readability)
unreachable_code_linter
(tags: best_practices, configurable, readability)
unused_import_linter
(tags: best_practices, common_mistakes, configurable, executing)
diff --git a/dev/reference/linters_with_defaults.html b/dev/reference/linters_with_defaults.html
index 5facd0d3f..fc882c2c9 100644
--- a/dev/reference/linters_with_defaults.html
+++ b/dev/reference/linters_with_defaults.html
@@ -104,7 +104,7 @@ Examples# When using interactively you will usually pass the result onto `lint` or `lint_package()`
f <- withr::local_tempfile(lines = "my_slightly_long_variable_name <- 2.3", fileext = "R")
lint(f, linters = linters_with_defaults(line_length_linter = line_length_linter(120L)))
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c12c3d1d2R': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed62ea00efR': No such file or directory
#> Error in file(con, "r"): cannot open the connection
# the default linter list with a different line length cutoff
diff --git a/dev/reference/lintr-deprecated.html b/dev/reference/lintr-deprecated.html
index a15254710..4041e8bc7 100644
--- a/dev/reference/lintr-deprecated.html
+++ b/dev/reference/lintr-deprecated.html
@@ -101,6 +101,8 @@ Usage
extraction_operator_linter()
+unnecessary_nested_if_linter()
+
with_defaults(..., default = default_linters)
# will produce lints
f <- withr::local_tempfile(lines = "x <- 1\n")
readLines(f)
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c714934e': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed59cddaab': No such file or directory
#> Error in file(con, "r"): cannot open the connection
lint(
filename = f,
linters = trailing_blank_lines_linter()
)
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c714934e': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed59cddaab': No such file or directory
#> Error in file(con, "r"): cannot open the connection
# okay
f <- withr::local_tempfile(lines = "x <- 1")
readLines(f)
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c5129908e': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed45a9b644': No such file or directory
#> Error in file(con, "r"): cannot open the connection
lint(
filename = f,
linters = trailing_blank_lines_linter()
)
-#> Warning: cannot open file '/tmp/RtmpfwIXYL/file187c5129908e': No such file or directory
+#> Warning: cannot open file '/tmp/RtmpJ8tIhj/file18ed45a9b644': No such file or directory
#> Error in file(con, "r"): cannot open the connection