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

refactor custom function execution #150

Merged
merged 11 commits into from
Nov 1, 2024
Merged

refactor custom function execution #150

merged 11 commits into from
Nov 1, 2024

Conversation

zkamvar
Copy link
Member

@zkamvar zkamvar commented Oct 31, 2024

I've refactored the custom function execution functions. This refactor is mainly for the purposes of debugging and readability. I find this especially important when navigating a function that works with variables in other environments. Having the comments and the sentinel variables reduces the cognative load necessary to walk through the function during a debugging session.

During my refactor, I found that there was an untested error and a dangling else condition that should have resulted in an error in the case of a malformed config file. I added classes to those errors and added tests for them.

Note that this PR does not need to ship with the next version of hubValidations if we want to ship the new features immediately.

This will fix #148

 - make DRY code
 - add roxygen skeleton
 - split logical vectors into separate variables
 - insert explanatory comments
 - add sentinel boolean variables
 - add roxygen skeleton
 - insert explanatory comments
 - unwrap calls that don't need to be wrapped
Copy link

github-actions bot commented Oct 31, 2024

@zkamvar zkamvar requested a review from annakrystalli October 31, 2024 19:53
Copy link
Member

@annakrystalli annakrystalli left a comment

Choose a reason for hiding this comment

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

Thanks for this refactor!

I have to be honest, I feel the level of commenting is a bit much. But I like the extra tests and checks and some of the sentinel variables do make it easier to follow.

Overall definitely an improvement in robustness and readability 👍

R/exec_cfg_check.R Outdated Show resolved Hide resolved
R/exec_cfg_check.R Outdated Show resolved Hide resolved
R/exec_cfg_check.R Outdated Show resolved Hide resolved
@zkamvar zkamvar merged commit 61107a9 into main Nov 1, 2024
8 checks passed
@zkamvar zkamvar deleted the znk/refactor/148 branch November 1, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Refactor exec_cfg_check.R
2 participants