Closed
Description
(nearly the same as #1433, and maybe both fixed at the same time, but filed separately since the cause is just different enough)
Compare:
lintr::lint('
switch(stat,
o = {
FUN <- FO
bw <- 0.01
},
s = {
FUN <- FS
bw <- 0.005
},
{
FUN <- FE
bw <- 2
}
)',
lintr::brace_linter())
vs
lintr::lint('
switch(stat,
o = {
FUN <- FO
bw <- 0.01
},
s = {
FUN <- FS
bw <- 0.005
},
# else
{
FUN <- FE
bw <- 2
}
)',
lintr::brace_linter())
# <text>:12:3: style: [brace_linter] Opening curly braces should never go on their own line and should always be followed by a new line.
# {
# ^
The latter also shouldn't lint -- the # else
comment is quite common/helpful, especially for long switch()
statements.