Skip to content

option to disable the object_usage_linter inside with expressions #1458

@AdrienLeGuillou

Description

@AdrienLeGuillou

would it be possible to add an option to the object_usage_linter so it does not check the inside of with expressions?

running lintr::lint("this_file.R")

#this_file.R
test_fun <- function(df) {
  with(df, first_var + second_var)
}

throw the following warnings:

this_file.R:2:12: warning: [object_usag e_linter] no visible binding for global variable ‘first_var’ with(df, first_var + second_var)
this_file.R:2:24: warning: [object_usag e_linter] no visible binding for global variable ‘second_var’ with(df, first_var + second_var)

but strangely no such warning appear with this code:

df <- readRDS("df_path.rds")
with(df, first_var + second_var)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-positivecode that shouldn't lint, but does

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions