lintr 3.1.0
Deprecations & Breaking Changes
.lintr
files can now be kept in the directory.github/linters
for better compatibility with Super-Linter. Note that this may be a breaking change if you already have a config in.github/linters
inside a subdirectory as well as in your R project's root, since the former will now be discovered first where it was ignored before. Please seevignette("lintr")
for details on how configs are discovered (#1746, @tonyk7440 and @klmr).single_quotes_linter()
is deprecated in favor of the more generalizablequotes_linter()
(#1729, @MichaelChirico).unneeded_concatentation_linter()
is deprecated in favor ofunnecessary_concatenation_linter()
for naming consistency (#1707, @IndrajeetPatil).consecutive_stopifnot_linter()
is deprecated in favor of the more general (see below)consecutive_assertion_linter()
(#1604, @MichaelChirico).no_tab_linter()
is deprecated in favor ofwhitespace_linter()
for naming consistency and future generalization (#1954, @MichaelChirico).available_linters()
prioritizestags
overexclude_tags
in the case of overlap, i.e., tags listed in both arguments are included, not excluded. We don't expect many people to be affected by this, and the old behavior was not made explicit in the documentation, but make note of it here since it required changing a test in lintr's own suite wherelinters_with_tags()
implicitly assumed this behavior.lint()
,lint_dir()
, andlint_package()
no longer accept certain arguments (cache=
forlint()
,relative_path=
for the latter two) positionally. Thewarning()
since 3.0.0 has been upgraded to an error.
Bug fixes
-
linters_with_tags()
now includes the previously missing spaces around "and" when listing missing linters advertised byavailable_linters()
.
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) -
fixed_regex_linter()
is more robust to errors stemming from unrecognized escapes (#1545, #1845, @IndrajeetPatil). -
get_source_expressions()
can handle Sweave/Rmarkdown documents with reference chunks like<<ref_file>>
(#779, @MichaelChirico).
Note that these are simply skipped, rather than attempting to retrieve the reference and also lint it. -
assignment_linter()
no longer lints assignments in braces that include comments whenallow_trailing = FALSE
(#1701, @ashbaldry) -
object_usage_linter()
- No longer silently ignores usage warnings that don't contain a quoted name (#1714, @AshesITR)
- No longer fails on code with comments inside a multi-line call to
glue::glue()
(#1919, @MichaelChirico)
-
namespace_linter()
correctly recognizes backticked operators to be exported from respective namespaces (likerlang::`%||%`
) (#1752, @IndrajeetPatil) -
lint_package()
correctly finds a package from within a subdir if thepath
points to anywhere within the package (#1759, @AshesITR) -
Improved error behavior in
Lint()
,lint()
andxml_nodes_to_lints()
(#1427, #763, @AshesITR)Lint()
validates its inputs more thoroughly, preventing errors duringprint.Lints
like "Error in rep.int(character, length) : invalid 'times' value:".lint()
no longer tries to create an expression tree with unexpected end of input errors, because they can be broken.xml_nodes_to_lints()
warns if it can't find lint locations and uses dummy locations as a fallback.
-
linters_with_defaults()
no longer erroneously marks linter factories as linters (#1725, @AshesITR). -
Row names for
available_linters()
data frame are now contiguous (#1781, @IndrajeetPatil). -
object_name_linter()
allows all S3 group Generics (see?base::groupGeneric
) and S3 generics defined in a different file in the same package (#1808, #1841, @AshesITR) -
object_usage_linter()
improves identification of the exact source of a lint- for undefined variables in expressions with where the variable is used as a symbol in a usual way, for example in a formula or in an extraction with
$
(#1914, @MichaelChirico). - for general usage warnings without location info (#1986 and #1917, @AshesITR)
- for undefined variables in expressions with where the variable is used as a symbol in a usual way, for example in a formula or in an extraction with
-
function_left_parentheses_linter()
produces a more specific lint (and no longer fails) when the opening parenthesis is on a different line thanfunction
or the call name (#1953, @MichaelChirico). Thanks also to @IndrajeetPatil and @lorenzwalthert for identifying a regression in the initial fix, #1963.
Changes to defaults
-
Set the default for the
except
argument induplicate_argument_linter()
toc("mutate", "transmute")
.
This allows sequential updates likex |> mutate(a = b + 1, a = log(a))
(#1345, @IndrajeetPatil). -
object_usage_linter()
- gains
skip_with
argument to skip code inwith()
expressions. To be consistent with
R CMD check
, it defaults toTRUE
(#941, #1458, @IndrajeetPatil). - Handles backticked symbols inside {glue} expressions correctly, e.g.
glue("{`x`}")
correctly
determinesx
was used (#1619, @MichaelChirico) - Detects problems inside R4.1.0+ lambda functions (
\(...)
) (#1933, @MichaelChirico)
- gains
-
spaces_inside_linter()
allows terminal missing keyword arguments (e.g.alist(arg = )
; #540, @MichaelChirico) -
brace_linter()
allows empty braced expression on the same line (e.g.while (updating_condition()) { }
)
regardless ofallow_single_line
to match the corresponding behavior in {styler}. This is an expedient while
the style guide on handling this case awaits clarification: tidyverse/style#191.
(#1346, @MichaelChirico) -
undesirable_function_linter()
andundesirable_operator_linter()
now produce an error
if empty vector of undesirable functions or operators is provided (#1867, @IndrajeetPatil). -
New linters which are also included as defaults (see "New linters" for more details):
indentation_linter()
quotes_linter()
unnecessary_concatenation_linter()
whitespace_linter()
-
lint_package()
also looks for files inexec/
(#1950, @jmaspons).
New and improved features
-
New
get_r_string()
helper to get the R-equivalent value of a string, especially useful for R-4-style raw strings.
Previously an internallintr
helper, now exported to facilitate writing custom linters (#1493, @MichaelChirico). -
object_usage_linter()
improves lint metadata when detecting undefined infix operators, e.g.%>%
or:=
(#1497, @MichaelChirico) -
unused_import_linter()
can detect datasets from imported packages and no longer
warns when a package is imported only for its datasets (#1545, @IndrajeetPatil). -
When a linter triggers an error,
lint()
will provide a more actionable summary of where the
error occurred, particularly useful for cases likelint_package()
where both the responsible file
and the responsible linter would be unknown (@MichaelChirico).Typically, linters should not themselves cause R to stop -- syntax errors lead to error lints,
for example. Please report such failures as they are likely bugs. -
pipe_continuation_linter()
recognizes violations involving the native R pipe|>
(#1609, @MichaelChirico) -
paste_linter()
also catches usages likepaste(rep("*", 10L), collapse = "")
that can be written more
concisely asstrrep("*", 10L)
(#1108, @MichaelChirico) -
spaces_inside_linter()
produces lints for spaces inside[[
(#1673, @IndrajeetPatil). -
sprintf_linter()
also applies togettextf()
(#1677, @MichaelChirico) -
Documentation for all linters contains examples of code that does and does not produce lints (#1492, @IndrajeetPatil).
-
implicit_integer_linter()
gains parameterallow_colon
to skip lints on expressions like1:10
(#1155, @MichaelChirico) -
infix_spaces_linter()
supports the native R pipe|>
(#1793, @AshesITR) -
unnecessary_concatenation_linter()
(f.k.a.unneeded_concatenation_linter()
) no longer lints onc(...)
(i.e., passing...
in a function call) whenallow_single_expression = FALSE
(#1696, @MichaelChirico) -
object_name_linter()
gains parameterregexes
to allow custom naming conventions (#822, #1421, @AshesITR) -
literal_coercion_linter()
reports a replacement in the lint message, e.g. code likeas.integer(1)
will
suggest using1L
instead, and code likeas.numeric(NA)
will suggest usingNA_real_
instead (#1439, @MichaelChirico) -
Added
format()
functions forlint
andlints
(#1784, @AshesITR) -
all_linters()
function provides an easy way to access all available linters (#1843, @IndrajeetPatil) -
missing_argument_linter()
allows missing arguments inquote()
calls (#1889, @IndrajeetPatil). -
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. -
available_linters()
gives priority totags
overexclude_tags
in the case of overlap. In particular, this means thatavailable_linters(tags = "deprecated")
will work to return deprecated linters without needing to specifyexclude_tags
(#1959, @MichaelChirico). -
The {lintr} configuration file is now searched in the system's user configuration path; the lintr config filename can
also be configured explicitly by setting the environment variableR_LINTR_LINTER_FILE
(#460, @klmr) -
Errors in the {lintr} configuration file now produce more informative error messages (#886, @AshesITR)
New linters
-
matrix_apply_linter()
recommends use of dedicatedrowSums()
,colSums()
,colMeans()
,rowMeans()
overapply(., MARGIN, sum)
orapply(., MARGIN, mean)
. The recommended alternative is much more efficient and more readable (#1869, @Bisaloo). -
unnecessary_lambda_linter()
: detect unnecessary lambdas (anonymous functions), e.g.
lapply(x, function(xi) sum(xi))
can belapply(x, sum)
andpurrr::map(x, ~quantile(.x, 0.75, na.rm = TRUE))
can bepurrr::map(x, quantile, 0.75, na.rm = TRUE)
. Namingprobs = 0.75
can further improve readability (#1531, #1866, @MichaelChirico, @Bisaloo). -
redundant_equals_linter()
for redundant comparisons toTRUE
orFALSE
likeis_treatment == TRUE
(#1500, @MichaelChirico) -
lengths_linter()
for encouraging usage oflengths(x)
instead ofsapply(x, length)
(and similar) -
function_return_linter()
for handling issues in functionreturn()
statements. Currently handles assignments within thereturn()
clause, e.g.return(x <- foo())
(@MichaelChirico) -
boolean_arithmetic_linter()
for identifying places where logical aggregations are more appropriate, e.g.
length(which(x == y)) == 0
is the same as!any(x == y)
or evenall(x != y)
(@MichaelChirico) -
for_loop_index_linter()
to prevent overwriting local variables in afor
loop declared likefor (x in x) { ... }
(@MichaelChirico) -
is_numeric_linter()
for redundant checks equivalent tois.numeric(x)
such asis.numeric(x) || is.integer(x)
or
class(x) %in% c("numeric", "integer")
(@MichaelChirico) -
empty_assignment_linter()
for identifying empty assignments likex = {}
that are more clearly written asx = NULL
(@MichaelChirico) -
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 theNAMESPACE
; @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 nestedif
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 argumentdelimiter
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 ofsingle_quotes_linter()
. -
unnecessary_concatenation_linter()
is simplyunneeded_concatenation_linter()
, renamed. -
consecutive_assertion_linter()
(f.k.a.consecutive_stopifnot_linter()
) now lints for consecutive calls toassertthat::assert_that()
(as long as themsg=
argument is not used; #1604, @MichaelChirico). -
whitespace_linter()
is simplyno_tab_linter()
, renamed. In the future, we plan to extend it to work for different whitespace preferences.
Notes
-
{lintr} now depends on R version 3.5.0, in line with the tidyverse policy for R version compatibility.
-
lint()
continues to support Rmarkdown documents. For users of custom .Rmd engines, e.g.
marginformat
from {tufte} ortheorem
from {bookdown}, note that those engines must be registered
in {knitr} prior to runninglint()
in order for {lintr} to behave as expected, i.e., they should be
shown as part ofknitr::knit_engines$get()
.For {tufte} and {bookdown} in particular, one only needs to load the package namespace to accomplish
this (i.e., minimallyloadNamespace("tufte")
orloadNamespace("bookdown")
, respectively, will
register those packages' custom engines; sincelibrary()
also runsloadNamespace()
, running
library()
will also work). Note further that {tufte} only added this code to their.onLoad()
recently
after our request to do so (see rstudio/tufte#117). Therefore, ensure you're using a
more recent version to get the behavior described here for {tufte}.More generally, there is no requirement that
loadNamespace()
will register a package's custom {knitr}
engines, so you may need to work with other package authors to figure out a solution for other engines.Thanks to Yihui and other developers for their helpful discussions around this issue (#797, @IndrajeetPatil).
-
The output of
lint()
andLint()
gain S3 class"list"
to assist with S3 dispatch (#1494, @MichaelChirico)- As a corollary, we now register an
as_tibble
method for classlints
, conditional on {tibble} availability, to avoid dispatching to thelist
method which does not work withlint()
output (#1997, @MichaelChirico)
- As a corollary, we now register an
-
object_usage_linter()
gives a more helpful warning when aglue()
expression fails to evaluate (#1985, @MichaelChirico) -
The documentation of
object_name_linter()
now describes how"symbols"
works when passed to thestyles
parameter (#1924, @hedsnz).
What's Changed
- Bump to devel by @IndrajeetPatil in #1536
- GHA workflow
lint-changed-files
fails when a new lint is found in changed files by @IndrajeetPatil in #1522 object_usage_linter()
setsuseFancyQuotes=FALSE
by @IndrajeetPatil in #1523- move NEWS item about sarif_output() to the correct release by @MichaelChirico in #1537
- Edits to docs for linters by @IndrajeetPatil in #1480
- Get rid of version label and tooltip by @IndrajeetPatil in #1534
- Remove TODOs related to
{waldo}
update by @IndrajeetPatil in #1518 - Collapse near-identical sections in NEWS of 3.0.1 by @MichaelChirico in #1538
- Formatting changes to follow tidyverse style guide by @IndrajeetPatil in #1539
fixed_regex_linter()
doesn't fail with"\\;"
by @IndrajeetPatil in #1547unused_import_linter()
detects datasets from imports by @IndrajeetPatil in #1549- object_usage_linter gets correct metadata for infix operators by @MichaelChirico in #1525
- Slightly improve dataset symbol detection by @MichaelChirico in #1555
- Export get_r_string by @MichaelChirico in #1526
- Include
expect_*()
linters in.lintr_new
by @IndrajeetPatil in #1557 - Add arg to skip
with()
inobject_usage_linter()
by @IndrajeetPatil in #1548 - Add exceptions for
duplicate_argument_linter()
by @IndrajeetPatil in #1550 - Check with the oldest supported R version by @IndrajeetPatil in #1551
- remove expect_identical_linter() from .lintr_new, which we don't use by @MichaelChirico in #1561
- use 4.1.0 for consistency by @MichaelChirico in #1562
- Remove
{covr}
unneeded fromSuggests
by @IndrajeetPatil in #1560 - Minor header formatting changes for old releases by @IndrajeetPatil in #1563
- Add R-CMD-check with non-english locale by @IndrajeetPatil in #1564
- New redundant_equals_linter by @MichaelChirico in #1556
- Sync up with lint workflow in
r-lib/actions
by @IndrajeetPatil in #1559 - Update docs and adds tests for Quarto files by @IndrajeetPatil in #1487
- New unnecessary_lambda_linter by @MichaelChirico in #1541
- Examples for ?expect_lint too wide for R CMD check by @MichaelChirico in #1571
- New
function_return_linter()
by @MichaelChirico in #1569 - Input validation tests for
available_linters()
by @IndrajeetPatil in #1572 - Create package Rd file by @IndrajeetPatil in #1577
- Add missing test to
function_return_linter()
by @IndrajeetPatil in #1578 - New lengths_linter by @MichaelChirico in #1568
- Improve docs about how to list and use all linters by @IndrajeetPatil in #1576
- switch away from //expr in brace_linter by @MichaelChirico in #1585
- switch away from //expr XPaths in paste_linter by @MichaelChirico in #1586
- Move away from //expr XPaths in object_usage_linter by @MichaelChirico in #1589
- Move away from //expr XPaths in string_boundary_linter by @MichaelChirico in #1588
- switch away from //expr XPaths in package_hooks_linter by @MichaelChirico in #1587
- Move more XPaths away from //expr logic by @MichaelChirico in #1590
- New boolean_arithmetic_linter by @MichaelChirico in #1579
- Include more linters in
.lintr_new
by @IndrajeetPatil in #1593 - Update docs for
extraction_operator_linter()
by @IndrajeetPatil in #1592 - Another batch of migrations away from //expr by @MichaelChirico in #1594
- friendlier failure of lint() by @MichaelChirico in #1583
- redundant equals by @MichaelChirico in #1595
- Add examples to documentation: Part-1 (a-b) by @IndrajeetPatil in #1591
- Get rid of a few lints by @IndrajeetPatil in #1596
- Follow style guide in a few test files by @IndrajeetPatil in #1598
- Finish styling remaining test files by @IndrajeetPatil in #1600
- Improve resilience of object_usage_linter() to glue syntax issues by @MichaelChirico in #1597
- Move deprecated linters to one file and hide them on website by @IndrajeetPatil in #1602
- More XPaths avoiding //expr by @MichaelChirico in #1605
- Complete switch away from //expr XPaths by @MichaelChirico in #1606
- Add examples to documentation: Part-2 (c-d) by @IndrajeetPatil in #1603
- switch to using a hanging indent for extended XPaths by @MichaelChirico in #1610
- Turn on codecov comments by @IndrajeetPatil in #1615
- Add examples to the docs for utilities by @IndrajeetPatil in #1618
- Error on a
NOTE
in R CMD check by @IndrajeetPatil in #1621 - improve handling of glued object extraction by @MichaelChirico in #1612
- Always qualify rex in tests, make private API calls clearer by @MichaelChirico in #1628
- Add nocov directives to Rd fragment functions by @IndrajeetPatil in #1627
- Add more missing tests by @IndrajeetPatil in #1624
- Add a test for
sarif_output()
by @IndrajeetPatil in #1623 - Anticipate more knitr engines in code blocks by @IndrajeetPatil in #1552
- Tests for
trailing_blank_lines_linter()
with chunks by @IndrajeetPatil in #1614 - New for_loop_index_linter by @MichaelChirico in #1629
- Add a few more linters to "lints changed" workflow by @IndrajeetPatil in #1632
- add examples to get_r_string by @MichaelChirico in #1640
- Handle <<reference_chunks>> in Rnw,Rmd by @MichaelChirico in #1642
- Add "list" to S3 class of lint(), Lint() output by @MichaelChirico in #1641
- handle alist(kwd = ) false positive by @MichaelChirico in #1643
- New empty_assignment_linter by @MichaelChirico in #1637
- Add examples to documentation: Part-3 (e) by @IndrajeetPatil in #1631
- Recognize |> in pipe_continuation_linter by @MichaelChirico in #1638
- Reformat lint example by @IndrajeetPatil in #1644
- nocov for unanticipated error by @MichaelChirico in #1647
- Use {withr} more comprehensively in tests to manage state by @MichaelChirico in #1646
- Additional test for
namespace_linter()
+ clean-up by @IndrajeetPatil in #1649 - Document default settings by @IndrajeetPatil in #1648
- New is_numeric_linter by @MichaelChirico in #1635
- Add examples to documentation: Part-4 (f-i) by @IndrajeetPatil in #1651
- Remove code to deal with broken namespaces by @IndrajeetPatil in #1653
- extend paste_linter() for strrep() equivalents by @MichaelChirico in #1652
- Consistently use
lint_msg
instead ofmsg
by @IndrajeetPatil in #1654 - Add examples to documentation: Part-5 (l-n) by @IndrajeetPatil in #1655
- nocov version-specific region by @MichaelChirico in #1659
- coverage test of xml_nodes_to_lints by @MichaelChirico in #1658
- New unnecessary_placeholder_linter by @MichaelChirico in #1656
- small simplification for glue, add coverage test by @MichaelChirico in #1660
- nocov unreachable helper by @MichaelChirico in #1663
- Add examples to documentation: Part-6 (o-p) by @IndrajeetPatil in #1664
- friendlier input validation, coverage in undesirable_operator_linter by @MichaelChirico in #1666
- nocov an unreachable error by @MichaelChirico in #1667
- jsonlite is a Suggests dependency by @MichaelChirico in #1670
- New routine_registration_linter by @MichaelChirico in #1669
- crayon is a Suggested dependency by @MichaelChirico in #1671
- nocov missing crayon branch by @MichaelChirico in #1676
- Add examples to documentation: Part-7 (q-s) by @IndrajeetPatil in #1674
spaces_inside_linter()
lints spaces after[[
by @IndrajeetPatil in #1678- Split S3 and S4 linters (and tests) into their own files by @IndrajeetPatil in #1680
- sprintf_linter works for gettextf by @MichaelChirico in #1679
- make Patrick required for tests by @MichaelChirico in #1682
unnecessary_placeholder_linter()
covers a few other ops by @IndrajeetPatil in #1681- keep "configurable" tag accurate by @MichaelChirico in #1683
- brace_linter() always allows {}/{ } by @MichaelChirico in #1685
- Change lint changed settings; add note to tag tests by @IndrajeetPatil in #1687
- Add examples to documentation: Part-8 (t-z) by @IndrajeetPatil in #1686
- Add examples to documentation: Part-9 (cleanup) by @IndrajeetPatil in #1688
- Further reading for no tabs linter by @IndrajeetPatil in #1690
- use parameterized test on public API for implicit_integer_linter() by @MichaelChirico in #1693
- 1:10 doesnt lint, optionally by @MichaelChirico in #1691
- Handle backtickd names in glue extraction by @MichaelChirico in #1630
- use backports::import instead of custom approach by @MichaelChirico in #1695
- don't lint c(...) in unneeded_concatenation_linter(!allow_single_expression) by @MichaelChirico in #1699
- always close con by @MichaelChirico in #1700
- Fix assignment_linter when comment further on in brace by @ashbaldry in #1702
- unnecessary_lambda_linter catches functions with braces by @MichaelChirico in #1704
- Style with styler and add directives where necessary to protect manual formatting by @IndrajeetPatil in #1705
- Minor cleanup in tests by @IndrajeetPatil in #1706
- Include
stringsAsFactors = FALSE
where relevant by @IndrajeetPatil in #1708 - Get rid of
unnecessary_lambda_linter()
lint by @IndrajeetPatil in #1710 - Wherever possible, prefer
expect_identical()
overexpect_equal()
by @IndrajeetPatil in #1712 - Wherever possible, prefer
expect_identical()
overexpect_equal()
: Part-2 by @IndrajeetPatil in #1713 - object_name_linter: add
regexes=
argument for custom style regexes by @AshesITR in #1421 - add NEWS for #1421 by @AshesITR in #1716
- Use public interface to test internal functions: Part-1 by @IndrajeetPatil in #1720
- Improve object_usage_linter() by @AshesITR in #1715
- Use public interface to test internal functions: Part-2 by @IndrajeetPatil in #1721
- Move path linters to their own files by @IndrajeetPatil in #1723
- customize lint message in literal_coercion_linter() by @MichaelChirico in #1722
- Use public interface to test internal functions: Part-3 by @IndrajeetPatil in #1726
- implement indentation_linter by @AshesITR in #1411
- Print the code in
indentation_linter()
examples by @IndrajeetPatil in #1732 - Remove warnings in examples for
expect_lint()
by @IndrajeetPatil in #1734 - Sync up GHA workflows with
r-lib/actions
by @IndrajeetPatil in #1738 - Remove unnecessary
loadNamespace()
call for{rex}
by @IndrajeetPatil in #1740 - Also check on windows R 4.1 by @IndrajeetPatil in #1741
- Modify a few more examples by @IndrajeetPatil in #1735
- Cleanup for a few tests by @IndrajeetPatil in #1744
- Port over
pkgdown::in_pkgdown()
by @IndrajeetPatil in #1747 - Run tests conditionally for
{mockery}
by @IndrajeetPatil in #1750 - Add "no suggests" R CMD check workflow by @IndrajeetPatil in #1739
- Move utilities for package and project root to their own file by @IndrajeetPatil in #1743
namespace_linter()
handles backticked operators by @IndrajeetPatil in #1753- Use
nolint
directives forundesirable_operator_linter()
lints by @IndrajeetPatil in #1748 - Further improvements for
lengths_linter()
by @IndrajeetPatil in #1749 - Add nolint for
ids_with_token()
definition by @IndrajeetPatil in #1756 - Address
undesirable_function_linter()
lints by @IndrajeetPatil in #1761 - use normalizePath() in find_package() by @AshesITR in #1765
- Remove
undesirable_operator_linter()
from.lintr_new
by @IndrajeetPatil in #1767 - Enhance and fix
indentation_linter
by @AshesITR in #1758 - Add GHA workflow to detect link rot by @IndrajeetPatil in #1772
- Improve pkgdown YAML formatting by @IndrajeetPatil in #1773
- Fix examples and add a new workflow to catch any future failures by @IndrajeetPatil in #1776
- Update URL for MegaLinter by @IndrajeetPatil in #1779
- Use public interface to test internal functions: Part-4 by @IndrajeetPatil in #1774
- Include only names of linters in example outputs by @IndrajeetPatil in #1780
- Don't mark linter factory functions as linters in
modify_defaults()
by @AshesITR in #1789 - Add sort_linter() by @Bisaloo in #1528
- add PIPE to infix_metadata by @AshesITR in #1793
- devtools -> remotes in installation instructions by @IndrajeetPatil in #1796
- Add tests for
no_tab_linter()
with pipes by @IndrajeetPatil in #1795 - Add test for native pipe in
commented_code_linter()
by @IndrajeetPatil in #1799 - Add tests for
spaces_inside_linter()
with pipes by @IndrajeetPatil in #1798 - Implement
unnecessary_nested_if_linter()
by @IndrajeetPatil in #1783 - avoid <<- usage by @MichaelChirico in #1809
- Tidy up DESCRIPTION file by @IndrajeetPatil in #1802
- Update
.lintr_new
to include newly added linters by @IndrajeetPatil in #1806 - Add CoC document by @IndrajeetPatil in #1801
- safer Lint(), xml_nodes_to_lints() and lint() by @AshesITR in #1788
- Fix missing row names in
available_linters()
by @IndrajeetPatil in #1813 - Implement
implicit_assignment_linter()
by @IndrajeetPatil in #1814 - Remove
implicit_assignment_linter()
lints from tests by @IndrajeetPatil in #1819 - Add
implicit_assignment_linter()
to config file by @IndrajeetPatil in #1818 - add format methods for lint and lints by @AshesITR in #1790
- Anticipate "no exceptions" case for
implicit_assignment_linter()
by @IndrajeetPatil in #1823 - Add tests for multi-line anonymous functions for
implicit_assignment_linter()
by @IndrajeetPatil in #1821 - Improve formatting for
brace_linter()
file by @IndrajeetPatil in #1825 - Bump roxygen2 version by @IndrajeetPatil in #1826
- More tests for
brace_linter()
with pipes and formula syntax by @IndrajeetPatil in #1828 - Fix
sarif_output()
format when linting produces no results by @pdil in #1837 - Fix R CMD check workflow by @IndrajeetPatil in #1851
- rename with underscore for consistency by @MichaelChirico in #1849
fixed_regex_linter()
doesn't fail with"\\/"
by @IndrajeetPatil in #1846- Allow
except = NULL
to remove all exceptions inimplicit_assignment_linter()
by @IndrajeetPatil in #1840 - Improve error message in
namespace_linter()
by @IndrajeetPatil in #1844 - consolidate find_* logic into one helper by @MichaelChirico in #1852
- Reorganize tests for
unneeded_concatenation_linter()
by @IndrajeetPatil in #1859 - Consistently use Markdown lists with seealso tags by @IndrajeetPatil in #1856
- Use braces in
tryCatch()
calls by @IndrajeetPatil in #1839 - Improve deprecation messages for
find_*()
by @IndrajeetPatil in #1861 - Deprecate
unnecessary_concatenation_linter()
by @IndrajeetPatil in #1862 - Start fresh session each time in RStudio by @IndrajeetPatil in #1857
- Improve formatting for
fixed_regrex_linter()
tests by @IndrajeetPatil in #1860 - friendlier error/warning for failing find_package() by @MichaelChirico in #1850
- Add S3 group generics to
.base_s3_generics
, include exported S3 generics in generic list by @AshesITR in #1842 - Implement
all_linters()
wrapper to access all available linters by @IndrajeetPatil in #1854 - Add a list of accepted "misspelled" words by @IndrajeetPatil in #1863
- Additional test for
unnecessary_placeholder_linter()
by @IndrajeetPatil in #1838 - Remove redundant nocov annotations in addins file by @IndrajeetPatil in #1864
- Tests for multiple lints in
unnecessary_nested_if_linter()
by @IndrajeetPatil in #1834 - Add new map_vec() to purrr_mappers vector by @Bisaloo in #1866
- Avoid implicit type coercion in conditional expressions using
length()
by @IndrajeetPatil in #1865 - Tests for multiple lints in
implicit_assignment_linter()
by @IndrajeetPatil in #1833 - Ignore
{purrr}
onR < 3.5
by @IndrajeetPatil in #1873 - Error on empty character vector args in undesirable linters by @IndrajeetPatil in #1870
- Add document on how to get help by @IndrajeetPatil in #1804
- Break down more tests into skip vs block pattern by @IndrajeetPatil in #1876
implicit_assignment_linter()
doesn't produce false positives with walrus operator by @IndrajeetPatil in #1878- Separate out tests for allowed assignments with braces by @IndrajeetPatil in #1872
- add assignment_as_infix = TRUE to indentation_linter() by @AshesITR in #1812
- Fix
T_and_F_symbol_linter()
example by @IndrajeetPatil in #1882 - Fix
condition_message_linter()
examples by @IndrajeetPatil in #1881 missing_argument_linter()
allows missing arguments inquote()
calls by @IndrajeetPatil in #1890- Revise exceptions to
implicit_assignment_linter()
by @IndrajeetPatil in #1817 - fix: update URLs to GHA workflow examples by @dpprdan in #1901
- remove mentions of lintr-bot by @dpprdan in #1902
- Add lifecycle badge to README by @IndrajeetPatil in #1903
- update codecov badge link by @MichaelChirico in #1916
- Bump R dependency to R3.5 by @MichaelChirico in #1922
- Add examples for
unnecessary_lambda_linter()
by @IndrajeetPatil in #1888 - Let MBCS warning fall through the first time it's encountered by @MichaelChirico in #1923
- Use specific imports for {rex} by @MichaelChirico in #1918
- Quit in-progress CI runs on new commit by @MichaelChirico in #1925
- Use new expectations to check for absence of exceptions by @IndrajeetPatil in #1880
- New
quotes_linter()
to replacesingle_quotes_linter()
by @MichaelChirico in #1931 - fix object_usage_linter with new xml2lang to avoid parsing comments by @MichaelChirico in #1935
- Add
matrix_apply_linter()
by @Bisaloo in #1869 - detect functional lambdas in object_usage_linter by @MichaelChirico in #1934
- Add missing spaces around "and" in glue_collapse() by @Bisaloo in #1946
- Catch consecutive calls to assert_that in renamed consecutive_asserion_linter by @MichaelChirico in #1940
- Avoid implicit assignments in expectations by @IndrajeetPatil in #1879
- fix nested tidy function call indentation by @AshesITR in #1948
- ignore irrelevant symbols when pinpointing undefined variable lints by @MichaelChirico in #1915
- Rename no_tab_linter to whitespace_linter by @MichaelChirico in #1955
- ns-qualify rex in tests by @MichaelChirico in #1957
- Outdent code extracted from indented chunks by @MichaelChirico in #1949
- prioritize tags over exclude_tags in available_linters by @MichaelChirico in #1961
- handle multiline case for function_left_parentheses_linter by @MichaelChirico in #1960
- exclude deprecated linters from overall list & tag-specific lists by @MichaelChirico in #1958
- Lint files in
exec
folder on lint_package by @jmaspons in #1950 - Check for .lintr file in extra subdirectory by @tonyk7440 in #1757
- Use XDG config directory by @klmr in #460
- Minor typos in NEWS by @bahadzie in #1973
- fix edge case in function_left_parentheses_linter by @MichaelChirico in #1982
- tidying code after latest run by @MichaelChirico in #1984
- fully deprecate positional arguments in lint()+friends by @MichaelChirico in #1992
- More helpful failure message for object_usage_linter() by @MichaelChirico in #1989
- more informative error message if a lintr config setting is broken by @AshesITR in #1994
- Fix parsing usage warnings from codetools without location info by @AshesITR in #1993
- Add an as_tibble method for class lints by @MichaelChirico in #1998
- also a method for as.data.table.lints by @MichaelChirico in #1999
- document "symbols" in object_name_linter (#1924) by @hedsnz in #2001
New Contributors
- @Bisaloo made their first contribution in #1528
- @pdil made their first contribution in #1837
- @jmaspons made their first contribution in #1950
- @tonyk7440 made their first contribution in #1757
- @bahadzie made their first contribution in #1973
- @hedsnz made their first contribution in #2001
Full Changelog: v3.0.2...v3.1.0