Skip to content

Don't require "nested" indentation for multiline formulas? #2996

@ThomasSoeiro

Description

@ThomasSoeiro

First, thank you for this very useful package!

Is the following lint intended?

txt <- "
y ~
  var_1 +
  var_2 +
  var_3
"
lintr::lint(
  txt,
  linters = lintr::linters_with_defaults(),
  parse_settings = FALSE
)
#> <text>:4:2: style: [indentation_linter] Indentation should be 4 spaces but is 2 spaces.
#>   var_2 +
#>  ^~~

lintr currently expects a "nested" indentation:

txt <- "
y ~
  var_1 +
    var_2 +
    var_3
"
lintr::lint(
  txt,
  linters = lintr::linters_with_defaults(),
  parse_settings = FALSE
)
#> ℹ No lints found.

I think it is suboptimal because there is no "hierarchy" between the variables.

FWIW, there have been similar discussions for air here: posit-dev/air#444.

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