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

object_usage_linter() tries too many assignments #1322

Closed
AshesITR opened this issue May 29, 2022 · 1 comment · Fixed by #1323
Closed

object_usage_linter() tries too many assignments #1322

AshesITR opened this issue May 29, 2022 · 1 comment · Fixed by #1323
Labels
bug an unexpected problem or unintended behavior

Comments

@AshesITR
Copy link
Collaborator

Seen in our own package when running lint_package():

..........Warning in formals(fun) : argument is not a function
Warning in body(fun) : argument is not a function
Warning in formals(fun) : argument is not a function
Warning in body(fun) : argument is not a function
...................................................Warning in formals(fun) : argument is not a function
Warning in body(fun) : argument is not a function
................................................................................................................................................

The reason is the XPath for object_usage_linter() finds e.g.

assign(
    envir = cache,
    x = digest_content(linters, filename),
    value = lints,
    inherits = FALSE
  )

which is not a function assignment.

@AshesITR
Copy link
Collaborator Author

For the future: Debugging this wasn't too easy because options(warn = 3) didn't throw, since the bug was hidden behind a try.
To locate it, a custom warning handler was needed. I used

withCallingHandlers(lint_package(), warning = function(w) print(sys.calls()))

@AshesITR AshesITR added the bug an unexpected problem or unintended behavior label May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant