lintr 3.0.1
-
Skip multi-byte tests in non UTF-8 locales (#1504)
-
modify_defaults()
no longer uses the mistaken"lintr_function"
S3 class, instead applying the
"linter"
class also common toLinter()
.Linter()
also includes"function"
in the S3
class of its output to facilitate S3 dispatch tofunction
methods where appropriate (#1392, @MichaelChirico).
Changes to defaults
-
brace_linter()
allows opening curly braces on a new line when there is
a comment ending the preceding line (#1433 and #1434, @IndrajeetPatil). -
seq_linter()
produces lint forseq(...)
, since it also cannot properly
handle empty edge cases (#1468, @IndrajeetPatil). -
seq_linter()
additionally lints on1:n()
(from {dplyr})
and1:.N
(from {data.table}) (#1396, @IndrajeetPatil). -
literal_coercion_linter()
lints {rlang}'s atomic vector constructors
(i.e.,int()
,chr()
,lgl()
, anddbl()
) if the argument is a scalar
(#1437, @IndrajeetPatil). -
redundant_ifelse_linter()
's lint message correctly suggests negation when
theyes
condition is0
(#1432, @IndrajeetPatil). -
seq_linter()
provides more specific replacement code in lint message
(#1475, @IndrajeetPatil).
New and improved features
-
unreachable_code_linter()
ignores trailing comments if they match a closing nolint block (#1347, @AshesITR). -
New
function_argument_linter()
to enforce that arguments with defaults appear last in function declarations,
see the Tidyverse design guide (#450, @AshesITR). -
New
allow_trailing
argument added toassignment_linter()
to check when assignment operators are at the
end of a line, and the value is on the following line (#1491, @ashbaldry)
New features
commented_code_linter()
now lints commented argument code, containing a trailing comma, as well (#386, @AshesITR).
For example a comment containing# na.rm = TRUE,
now triggers a lint.
Bug fixes
object_length_linter()
does not fail in case there are dependencies with no exports (e.g. data-only packages) (#1509, @IndrajeetPatil).get_source_expressions()
no longer fails on R files that match a knitr pattern (#743, #879, #1406, @AshesITR).- Parse error lints now appear with the linter name
"error"
instead ofNA
(#1405, @AshesITR).
Also, linting no longer runs if thesource_expressions
contain invalid string data that would cause error messages
in other linters. - Prevent
lint()
from hanging on Rmd files with some syntax errors (#1443, @MichaelChirico). get_source_expressions()
no longer omits trailing non-code lines from knitr files (#1400, #1415, @AshesITR).
This fixes the location information fortrailing_blank_lines_linter()
in RMarkdown documents without terminal
newlines.- The
vignette("lintr")
incorrectly citedexclude
as the key for setting file exclusions in.lintr
when it is
actuallyexclusions
. (#1401, @AshesITR) - Fixed file exclusion detection in
lint_dir()
so it no longer errors if there are multiple exclusions or no global
exclusions configured for a single file (#1413, #1442, @AshesITR).
Other changes
- The minimum needed version for soft dependency
{withr}
has been bumped to2.5.0
(#1404, @IndrajeetPatil). - Changed the deprecation warning for
with_defaults()
to also mentionmodify_defaults()
(#1438, @AshesITR).