Skip to content

Inconsistency w.r.t. vertical whitespace #875

@MichaelChirico

Description

@MichaelChirico

Currently styler appears inconsistent w.r.t. vertical whitespace.

Compare:

# leading/trailing whitespace is removed
styler::style_text('
function(x) {

  return(x)

}
')
# function(x) {
#   return(x)
# }
# no change
styler::style_text('
foo <- function(x) {

}
# foo <- function(x) {
# 
# }
')
# leading whitespace is unchanged
styler::style_text('
foo <- function(a) {

  # comment
  return(a)
}
# foo <- function(a) {
# 
#   # comment
#   return(a)
# }
')

PS the tidyverse guide is currently silent on any rules here, so inconsistency is the only per se issue with styler. I have filed tidyverse/style#185 to try and nudge the guide to be more explicit here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions