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

Missing dependency link, if function call happens within the arguments of a function #304

Open
vertesy opened this issue Mar 2, 2024 · 4 comments

Comments

@vertesy
Copy link

vertesy commented Mar 2, 2024

pkgnet::CreatePackageReport misses function calls that happens within the arguments of a function.
For instance GetGruffiClusteringName is a helper to guess granuleRes in ParseGruffiGranuleScoreName. See more in gruffi

ParseGruffiGranuleScoreName <- function(goID, obj = combined.obj, granuleRes = GetGruffiClusteringName(obj)) {
  Stringendo::kppu(granuleRes, "cl.av", make.names(goID))
}

I did:

pkgnet_result <- pkgnet::CreatePackageReport(package.name)
fun_graph     <- pkgnet_result$FunctionReporter$pkg_graph$'igraph'
PackageTools::convert_igraph_to_mermaid(graph = fun_graph, openMermaid = T, copy_to_clipboard = T)

The result:
https://github.com/jn-goe/gruffi/blob/main/Functions.md

The problem
The network is missing all, but one of the links to GetGruffiClusteringName(), bc all, but one uses were in the argument lines!

@jameslamb
Copy link
Collaborator

Thanks for the report. Are you interested in trying to contribute this?

@vertesy
Copy link
Author

vertesy commented Mar 4, 2024

Thanks James, looking at your codebase, and its structure, and I am clearly not at well versed enough in R.

As far as i understood the problem is using body(), e.g. in FunctionReporter() and the solution would be to use body() and formals() to parse the argument list as well. But body() appears at multiple locations so I am not confident.

> # Define a simple function
> myFunction <- function(x, y = 1, argX = .myfun(x)) {
+       return(x + y)
+   }
> # Use formals() to get the arguments of the function
> (formals(myFunction))
$x


$y
[1] 1

$argX
.myfun(x)

This may be not too useful, I am sorry for that.

@jameslamb
Copy link
Collaborator

It's been 2 years since we made any meaningful changes to the code in this library... everything in the current state could be changed if there was a need!

If you're not interested in contributing at this time, we'll leave it here as a feature request. This project isn't being actively maintained, but occasionally one of us decides to put a weekend into it, so it might be picked up in the future.

@vertesy
Copy link
Author

vertesy commented Mar 8, 2024

Okay, thank you that's fair!
I will try to allocate time - as said, the package code is more professional than what I write so it may take time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants