Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More glue fails and sneak case #1466

Closed
latot opened this issue Jul 22, 2022 · 1 comment · Fixed by #2038
Closed

More glue fails and sneak case #1466

latot opened this issue Jul 22, 2022 · 1 comment · Fixed by #2038
Labels
false-positive code that shouldn't lint, but does

Comments

@latot
Copy link

latot commented Jul 22, 2022

Hi, I was running linting and found this:

test.R

df <- data.frame(list(
a = c(1, 2, 3)
))

v <- "a"

dplyr::mutate(df, !!paste0(tolower(v), "_l") := df$a * 2)

The output of the linting:

test.r:7:31: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
dplyr::mutate(df, !!paste0(v, "_l") := df$a * 2)

Thx!

@IndrajeetPatil
Copy link
Collaborator

Reprex:

library(lintr)

df <- dplyr::tibble(a = c(1))
v <- "a"

dplyr::mutate(df, !!paste0(tolower(v), "_l") := df$a * 2)
#> # A tibble: 1 × 2
#>       a   a_l
#>   <dbl> <dbl>
#> 1     1     2

lint(
  text = 'dplyr::mutate(df, !!paste0(v, "_l") := df$a * 2)',
  linter = object_name_linter()
)
#> <text>:1:31: style: [object_name_linter] Variable and function name style should be snake_case or symbols.
#> dplyr::mutate(df, !!paste0(v, "_l") := df$a * 2)
#>                               ^~~~

Created on 2022-07-24 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-positive code that shouldn't lint, but does
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants