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

Review function names and file names #102

Open
moodymudskipper opened this issue Mar 7, 2022 · 1 comment
Open

Review function names and file names #102

moodymudskipper opened this issue Mar 7, 2022 · 1 comment
Milestone

Comments

@moodymudskipper
Copy link
Owner

moodymudskipper commented Mar 7, 2022

The file structure is not readable and it's not clear what functions are used where.

I'd like to to experiment with a new naming convention:

  • use | in file names to delimit "folders", e.g. "flow_view.R" contains flow_view()'s code, "flow_view|nomnoml.R" contains the code for flow_view_nomnoml() and save_nomnoml() -> no more numbers, but still a hierarchy
  • functions that are used only one parent function should be named in a way that reflects it, I started already with flow_view_vars() which contains the code for flow_view_vars..build_fun(), flow_view_vars..clean_body() etc
  • unexported functions that don't qualify for this go to utils|fun_name.R or utils|others.R

Though we already mostly established the hierarchy with our numbered files names, it would be nice to use {flow} itself should be used to draw this map.

A way to do it is to :

  • build a function calling all exported functions and only them
  • run flow_deps on it
  • return the graph data rather than the diagram (not supported yet either)
  • from this data categorise the functions and show a summary of the package

That would be useful when starting to contribute on an existing package, would be interesting to test on dm, dplyr, unglue, flow.

@moodymudskipper moodymudskipper added this to the 0.0.4 milestone Mar 7, 2022
@moodymudskipper
Copy link
Owner Author

This gives us the flow of all exported functions, so should include every function, we might support something like flow_view_deps("{flow}") or flow_view_deps({flow}) to do the following :

exported_funs <- getNamespaceExports("flow")
body_ <- str2lang(paste0(
"{",
paste0("flow::", exported_funs, collapse = ";"),
"}" )) flow <- as.function(list(body_)) all_funs <- paste0("flow:::", ls(asNamespace("flow")), "`")
flow::flow_view_deps(flow, promote = all_funs, out = "png", show_imports = "none")

@moodymudskipper moodymudskipper modified the milestones: 0.1.1, 0.1.2 Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant