Skip to content

lintr 3.0.1

Compare
Choose a tag to compare
@IndrajeetPatil IndrajeetPatil released this 16 Sep 15:58
· 526 commits to main since this release
  • 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 to Linter(). Linter() also includes "function" in the S3
    class of its output to facilitate S3 dispatch to function 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 for seq(...), since it also cannot properly
    handle empty edge cases (#1468, @IndrajeetPatil).

  • seq_linter() additionally lints on 1:n() (from {dplyr})
    and 1:.N (from {data.table}) (#1396, @IndrajeetPatil).

  • literal_coercion_linter() lints {rlang}'s atomic vector constructors
    (i.e., int(), chr(), lgl(), and dbl()) if the argument is a scalar
    (#1437, @IndrajeetPatil).

  • redundant_ifelse_linter()'s lint message correctly suggests negation when
    the yes condition is 0 (#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 to assignment_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 of NA (#1405, @AshesITR).
    Also, linting no longer runs if the source_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 for trailing_blank_lines_linter() in RMarkdown documents without terminal
    newlines.
  • The vignette("lintr") incorrectly cited exclude as the key for setting file exclusions in .lintr when it is
    actually exclusions. (#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 to 2.5.0
    (#1404, @IndrajeetPatil).
  • Changed the deprecation warning for with_defaults() to also mention modify_defaults() (#1438, @AshesITR).