Skip to content

styler 1.5.1 (2021-07-13)

Compare
Choose a tag to compare
@lorenzwalthert lorenzwalthert released this 13 Jul 10:06
138ff0f

Alignment detection

  • Code with left alignment after = in function calls is now recognized as
    aligned and won't be reformatted (#774, #777).

    # already detected previously
    call(
      x  = 12345,
      y2 =    17
    )
    
    # newly detected
    call(
      x  = 12345,
      y2 = 17
    )
    
  • Similarly, left aligned after comma is now detected (#785, #786).

    # previously detected
    call(
      x  = 12345, "It's old",
      y2 = 17,      "before"
    )
    
    tribble(
      ~x,             ~y,
      "another",     1:3,
      "b",       1211234
    )
    
    # newly detected
    call(
      x = 2,           p = "another",
      y = "hhjkjkbew", x = 3
    )
    
    
    tribble(
      ~x,        ~y,
      "another", 1:3,
      "b",       1211234
    )
    

    Also see vignette("detect-alignment").

Other new features

  • The base R pipe as introduced in R 4.1.0 is now styled the same way the
    magrittr pipe is (#803).
  • code chunks with explicit tidy = FALSE in an Rmd or Rnw code header are not
    styled anymore. This can be handy when the code can't be parsed, e.g.
    within a learnr tutorial (#790).
  • #> is recognized as an output marker and no space is added after # (#771).

Minor changes and fixes

  • No curly braces are added to else statements if they are within a pipe, as
    this can change evaluation logic of code involving the magrittr dot in rare
    cases (#816).
  • Line breaks between } and else are removed (#793).
  • In function calls, code after = #\n is indented correctly (#814).
  • Multi-expressions containing multiple assignments no longer remove line breaks
    if they are not causing blank lines (#809).
  • exclude_dirs in style_pkg() is now properly respected if it is a
    sub-directory of a directory that is scheduled for styling (e.g.
    test/testthat/some/dir) (#811).
  • The user is not prompted anymore to confirm the creation of a permanent cache
    as R.cache >= 0.15.0 uses a standard location in line with CRAN policies
    (#819).
  • R code chunks in nested non-R chunks in R markdown don't yield an error
    anymore when document is styled, chunks are still not styled (#788, #794).
  • cache_activate() and cache_deactivate() now respect the R
    option styler.quiet (#797).
  • multi_line attribute in parse table is now integer, not boolean (#782).
  • The style guide used in Addin is verified when set via R option (#789).
  • Improve pkgdown author URLs (#775).
  • Upgrade touchstone infra (#799, #805).
  • Don't test on R 3.3 anymore as tidyverse supports only four previous
    releases
    (#804).
  • Update Github Actions workflow (#810).

We’d like to thank everyone who has furthered the development of the latest release of styler through their contributions in issues and pull requests:

@ardydavari, @gadenbuie, @IndrajeetPatil, @jasonhan-vassar, @laresbernardo, @lorenzwalthert, @MichaelChirico, @Moohan, @njtierney, @pat-s, @psychelzh, @pvalders, @RoyalTS, and @russHyde.