r-lib / styler

Non-invasive pretty printing of R code
https://styler.r-lib.org
Other
724 stars 71 forks source link

Styler and lintr disagree on what happens after a linebreak #1188

Open dsweber2 opened 6 months ago

dsweber2 commented 6 months ago

Styler auto-formats to:

  if (TRUE ||
    FALSE) {
    TRUE
  }

While linter prefers:

  if (TRUE ||
        FALSE) {
    TRUE
  }

I don't really have strong opinions on which of these should happen, I would just like my tools to not contradict each other. It makes CI a mess. paired issue https://github.com/r-lib/lintr/issues/2535

dshemetov commented 6 months ago

My workaround for this has been

if (
  TRUE ||
    FALSE
) {
  TRUE
}
MichaelChirico commented 6 months ago

possible duplicate of #1065, which also points to an open issue in the style guide about trying to clarify such cases upstream: https://github.com/tidyverse/style/issues/197