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

Add function to return details of report script from parsed exprs #129

Merged
merged 8 commits into from
Mar 8, 2024

Conversation

r-ash
Copy link
Contributor

@r-ash r-ash commented Feb 29, 2024

In the runner we want to get the parameters for a report given a name and a hash to run on. So we use git show to see the contents of the file at this point. So we want a way to pass this already read contents into this function to extract the details (so we can look at the parameters)

Struggling to think of a great name for the function here so very open for any suggestions, also wondering if I should do a @noRd on this so that we're not advertising this as a function for other people to use?

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4a060c1) to head (e435441).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #129   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           40        40           
  Lines         3621      3628    +7     
=========================================
+ Hits          3621      3628    +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@r-ash r-ash requested review from richfitz and M-Kusumgar February 29, 2024 16:52
NAMESPACE Outdated
@@ -4,6 +4,7 @@ S3method(format,orderly_query)
S3method(print,orderly_cleanup_status)
S3method(print,orderly_query_explain)
export(orderly_artefact)
export(orderly_build_script_details)
Copy link
Member

Choose a reason for hiding this comment

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

What about calling it orderly_parse() and have it take arguments of either path or expr, then just documenting it as experts use? I can see this being generally useful really

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep I like that

Copy link
Member

@richfitz richfitz left a comment

Choose a reason for hiding this comment

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

this looks good - minor (I hope) validation suggestions here

R/read.R Outdated
#' the parsed AST from an orderly script, parses details
#' of any calls to the orderly_ in-script functions into intermediate
#' representation for downstream use. Also validates that any calls to
#' orderly_ in-script functions are well-formed.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#' orderly_ in-script functions are well-formed.
#' `orderly_*` in-script functions are well-formed.

R/read.R Outdated
#'
#' @return Parsed orderly entrypoint script
#' @export
orderly_parse <- function(entrypoint_script, entrypoint_filename) {
Copy link
Member

Choose a reason for hiding this comment

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

Not sold on these argument names (sorry). How about accepting exprs and filename. Probably the input needs checking too (so for entrypoint_filename / filename use assert_file_exists and for entrypoint_script use assert_is(., "expression") I think).

You should also check that exactly one of these is given; this is quite annoying to do; you can use missing() to check that the argument was not given and error if both are !missing() but this makes it hard to program against sometimes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially put this in but felt kind of gross when chatting through it with Mantra, I've split this into 2 functions now. How does that look?

@r-ash r-ash requested a review from richfitz March 4, 2024 10:28
Copy link
Contributor

@M-Kusumgar M-Kusumgar left a comment

Choose a reason for hiding this comment

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

Nice one! i think tiny doc change but otherwise all good

R/read.R Outdated Show resolved Hide resolved
r-ash and others added 2 commits March 5, 2024 17:38
@r-ash r-ash merged commit 490391b into main Mar 8, 2024
11 checks passed
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.

3 participants