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

Ability to only log package use and unapproved packages, instead of functions #222

Open
nicholas-masel opened this issue Apr 17, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@nicholas-masel
Copy link
Collaborator

Feature Idea

Currently this package logs package and functions used and unapproved use. It would be nice if this could be set to only log packages. Package logging is more reliable than functions. We also might want to consider flagging function use as experimental. It doesn't work with objects that contain multiple functions (like knitr).

Relevant Input

No response

Relevant Output

No response

Reproducible Example/Pseudo Code

No response

@nicholas-masel nicholas-masel added the enhancement New feature or request label Apr 17, 2024
@nicholas-masel nicholas-masel self-assigned this Jan 16, 2025
@nicholas-masel
Copy link
Collaborator Author

Possible designs:

  1. If approved.rds only has package names, check packages only. If it has both library and function names, check functions.
  2. Create a new option for package only checks.

Thoughts @kodesiba @bms63 @parmsam-pfizer?

@nicholas-masel
Copy link
Collaborator Author

Linking #168

@nicholas-masel
Copy link
Collaborator Author

We currently log used packages and functions, and optionally show unapproved function use. Do we want to give the ability to toggle all of these combinations?

  1. Log used packages only
  2. Log used packages and functions
  3. Log used packages and log unapproved package use
  4. Log used packages and functions and log unapproved package use
  5. Log use packages and functions and long unapproved package and function use

@parmsam-pfizer
Copy link
Collaborator

parmsam-pfizer commented Feb 20, 2025

I like the idea of providing flexibility on the level of logging. I understand there are some cases where function use logging doesn't work well, but it's really nice to have. It's a feature, for example, that I've proposed using for the ADRG group to get a table of used functions grouped by package: phuse-org/adrgOS#4

Issue #168 suggests potentially moving over to a static code analysis for identify which packages are used before running the code. I think we'd need to still run the code to determine which functions map to which R packages. Maybe if we provide a setting to only log package use, we could do that (log package use only) before code execution via the proposed solution in #168 (comment)

@nicholas-masel
Copy link
Collaborator Author

nicholas-masel commented Mar 5, 2025

Static code analysis capturing library(), require(), package::function(), or package:::function() will not capture the base package use or any default packages (see getOption("defaultPackages")) used, since these are attached at study start.

For example:

--------------------------------------------------------------------------------
-                                Used Package/s                                -
--------------------------------------------------------------------------------
{package:dplyr}
{package:tidyr}
--------------------------------------------------------------------------------
-                          Used Package and Functions                          -
--------------------------------------------------------------------------------
{package:base} library, mean
{package:dplyr} %>%, group_by, summarize
{package:tidyr} pivot_wider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants