-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
False positive in indentation_linter()
?
#1800
Comments
The reason for this is that the indent triggered by "%t%" <- function(l, r) { list(l = l, r = r) }
1 %t% 2 %t% 3
#> $l
#> $l$l
#> [1] 1
#>
#> $l$r
#> [1] 2
#>
#>
#> $r
#> [1] 3 Created on 2022-12-05 with reprex v2.0.2 Seems like a matter of taste if this syntactical difference between To me, a trailing x <- letters[1:3] %>%
paste0() %>%
length() instead. I just checked PyCharms Auto-Indent and it agrees with lintr. |
Thanks for the explanation. Makes sense to not have a trailing Why is this important? The This means that users are going to see build failures for writing tidyverse code in a style that the style guide explicitly says is acceptable. IMO, this is surprising and frustrating for the user. We have a few options out of this quagmire:
|
I think an optional argument (defaulting to tidyverse style) is in order. |
Q is, is this worth demoting |
I'd decide that based on how common the code style is that triggers the false-positive. var <-
function_call(
arg1 +
also_arg1,
arg2
) Maybe only direct children infix tokens should be excluded? I've made a PR to fix this issue, so we can keep |
Possibly related to r-lib/styler#1065.
Created on 2022-12-05 with reprex v2.0.2
This is what
{lintr}
expects:But
{styler}
changes this to the above-mentioned version that produces lints.The text was updated successfully, but these errors were encountered: