Skip to content

{styler} 1.7.0 (2022-03-13)

Choose a tag to compare

@lorenzwalthert lorenzwalthert released this 14 Mar 07:10
· 812 commits to main since this release
9a5d256

API changes

  • new R option styler.cache_root (defaulting to "styler") that determines the sub-directory under the {R.cache} cache directory that {styler} uses. Non-default caches won't be cleaned up by {styler}. We suggest "styler-perm" (also used by {precommit}).

  • stylerignore markers are now interpreted as regular expressions instead of comments that must match exactly. This allows to specify multiple markers in one regular expression for styler.ignore_start and styler.ignore_stop, e.g. to use markers for lintr and styler on the same line, you can use options(styler.ignore_start = "nolint start|styler: off":

    # nolint start, styler: off
    1 +1
    # nolint end
    # styler: on

    As a consequence of this approach, the defaults for styler.ignore_start and styler.ignore_stop omit the # (#849).

Features

  • {styler} can be ran via GitHub Actions using usethis::use_github_action("style") (#914).
  • added guarantee that styled code is parsable (#892).
  • Developers can now create style guides with indention characters other than spaces (#916).

Documentation

  • Add vignette on distributing style guide (#846, #861).
  • Fix argument name filetype in Example for style_dir() (#855).

Bug fixes

  • Piped function without brackets substitute(x %>% y) don't get () added anymore for one level deep (not more yet, see #889), as this can change outcome of the code (#876).
  • .onLoad() method no longer broken with {cli} >= 3.1 (#893).
  • Function calls containing + should no longer give any error on styling when there are comments and line breaks under certain circumstances (#905).
  • rules that add tokens don't break stylerignore sequences anymore (#891).
  • Alignment detection respects stylerignore (#850).
  • Unaligned expressions with quoted key (e.g. c("x" = 2)) are now correctly detected (#881).
  • ~ causes now indention, like +, -, | etc. (#902).
  • Warning: Unknown or uninitialised column: was fixed (#885).
  • function calls with unequal number of token on different lines are no longer deemed aligned if there are arbitrary spaces around the tokens on the lines with most tokens (#902).
  • if a line starts with EQ_SUB (=), the corresponding key is moved to that line too (#923).
  • ensure a trailing blank line also if the input is cached (#867).
  • Preserve trailing blank line in roxygen examples to simplify concatenation of examples (#880).
  • indenty_by is now also respected when curly braces are added to an if statement by {styler} (#915).
  • An error is now thrown on styling if input unicode characters can't be correctly parsed for Windows and R < 4.2 (#883).
  • styling of text does not error anymore when the R option OutDec is set to a non-default value (#912).

Infrastructure

  • Remove dependency on {xfun} (#866).
  • Remove {glue} dependency that was only used by {touchstone} script and is declared as a dependency already in the respective action (#910).
  • Bump minimal R requirement to 3.4 in line with the tidyverse, which allowed to remove the dependency at {backports} and some exception handling.
  • rename default branch to main (#859).
  • the built package size has been reduced by ~50% by listing *-in_tree files in .Rbuildignore (#879).
  • Enable pre-commit.ci (#843).
  • use pre-commit via GitHub Actions (#872).
  • terminate running jobs on new push to save resources (#888).
  • Use the {touchstone} GitHub Action instead of the literal script (#889).
  • upgrade R CMD check Github Actions to use v2.
  • {styler} test are relaxed to not assume a specific error message on the wrong usage of _ (#929).

Thanks to all contributors that made this release possible:

@bersbersbers, @daniel-wrench, @dbykova, @EngrStudent, @hadley, @IndrajeetPatil, @jam1015, @jooyoungseo, @kalaschnik, @kaytif, @kpagacz, @krlmlr, @lionel-, @lorenzwalthert, @maelle, @MichaelChirico, @mine-cetinkaya-rundel, @neuwirthe, @Polkas, @pwang2, @sebffischer, @ShixiangWang, @ssh352, and @xjtusjtu.