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

[LINT_BUG]: Function argument confused with a box module #131

Open
Gotfrid opened this issue Aug 14, 2024 · 1 comment
Open

[LINT_BUG]: Function argument confused with a box module #131

Gotfrid opened this issue Aug 14, 2024 · 1 comment
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Gotfrid
Copy link
Member

Gotfrid commented Aug 14, 2024

box.linters version

0.9.1

Sample source code to lint

box::use(
  app/logic/table,
)

#' @param data list(summary = reactive(data.frame()))
#' @export
do_something <- function(data) {
  table$summary(data$summary())
}

Lint command used

rhino::lint_r('app.R')

Lint result

app.R:8:17: warning: [box_usage_linter] <package/module>$function does not exist.
  table$summary(data$summary())
                ^~~~~~~~~~~~

Expected result

No errors expected. Note that this behaviour happens specifically when there is a box::use statement that imports a local module.

@radbasa
Copy link
Collaborator

radbasa commented Aug 20, 2024

This is a good catch!

We have some logic to handle the object$function() pattern. We identify if the pair exists as exported by a box::use call, or it is a special use case as in the example code.

However, it now sees data$summary() and trips over summary() that exists as part of table$summary(). Will need to rethink the logic for this.

@radbasa radbasa self-assigned this Aug 21, 2024
@radbasa radbasa added bug Something isn't working good first issue Good for newcomers labels Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants