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

Function summary table generator #5

Merged
merged 23 commits into from
Jan 30, 2024
Merged

Function summary table generator #5

merged 23 commits into from
Jan 30, 2024

Conversation

RobertASmith
Copy link
Contributor

The tabulate_functions_in_folder function is designed to:

  • extract the names of all functions used in the project folder within R scripts.
  • return a dataframe with all functions listed next to the software package they are from
  • allow users to exclude certain packages so as not to be overwhelmed (e.g. base R has thousands of functions).

Next steps:

  • currently requires packages to be loaded to identify which package a function is from. If the package is not loaded (e.g. with library("package_name") then the function call will be identified as a function with a 'unknown' package. It would be good to use the CRAN lookup to guess the package (dangerous though for the user).
  • it would be good to be able to define which of these functions have a test associated with them, another column could be added to the table to provide the file in which the function was tested (or NULL if no tests undertaken).

The aim of this is that a user reviewing a model in R will be able to see:

  • the functions used by the model (and the package they are from)
  • whether they have a test associated with them and where that test is!

@RobertASmith
Copy link
Contributor Author

RobertASmith commented Jan 16, 2024

image

The foo fighters, see name of branch!

Copy link
Collaborator

@Smit-tay Smit-tay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, and passes tests.

@RobertASmith
Copy link
Contributor Author

RobertASmith commented Jan 25, 2024

OK, so this is awful, but it does do something.

The function below looks through all functions used in the "./inst" folder in the project. It identifies the function packages, and then checks if there is a corresponding test in the 'tests' folder, the script where the function is defined, and looks for the cheers roxygen tag associated with the function. (currently references to '@family' but this will change)

assertHE::get_summary_table(path = "./inst",test_path = "../tests")

The result is a dataframe that looks like this:

image

@W-Mohammed could you build this package locally for this branch and try running the code above. Apologies for messy code!

@bitowaqr for visibility.

@RobertASmith RobertASmith merged commit d6e7ca1 into main Jan 30, 2024
5 of 6 checks passed
@RobertASmith RobertASmith deleted the RS_foo_finder branch January 30, 2024 17:38
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

Successfully merging this pull request may close these issues.

2 participants