Skip to content

127 introduce within.qenv - #147

Closed
chlebowa wants to merge 6 commits into
mainfrom
127_qenv_within@main
Closed

127 introduce within.qenv#147
chlebowa wants to merge 6 commits into
mainfrom
127_qenv_within@main

Conversation

@chlebowa

@chlebowa chlebowa commented Oct 2, 2023

Copy link
Copy Markdown
Contributor

Closes #127

Added an S3 within method for class qenv.
Usage: within(data, expr, code, ...).

  • argument data is qenv, this is handled by S3 dispatch
  • argument expr is for literal code
  • argument code is for variables holding code (call, list of calls, expression, list of expressions) or literal character strings

Code passed in any form is converted into list of (single) calls, which are evaluated sequentially.
The whole code is appended to the @code slot. Currently this is stored as expression but following #146 the slot will hold a single string, which will enable keeping comments.
Characters (vectors or strings) passed to code are stored as single strings, combined with paste(..., collapse = "\n").
Language (calls or lists of calls, expressions or lists of expressions) passed to code are deparsed and combined likewise.

@chlebowa chlebowa added the core label Oct 2, 2023
@chlebowa
chlebowa requested review from gogonzo and m7pr October 2, 2023 10:02
@chlebowa chlebowa changed the title 127 qenv within@main 127 introduce within.qenv Oct 2, 2023
@chlebowa
chlebowa marked this pull request as ready for review October 2, 2023 10:03
@github-actions

github-actions Bot commented Oct 2, 2023

Copy link
Copy Markdown
Contributor

badge

Code Coverage Summary

Filename                 Stmts    Miss  Cover    Missing
---------------------  -------  ------  -------  ---------
R/include_css_js.R           7       7  0.00%    12-20
R/qenv-concat.R             10       0  100.00%
R/qenv-constructor.R        12       0  100.00%
R/qenv-eval_code.R          48       2  95.83%   91, 100
R/qenv-get_code.R           18       0  100.00%
R/qenv-get_var.R            19       0  100.00%
R/qenv-get_warnings.R       24       0  100.00%
R/qenv-join.R               46       0  100.00%
R/qenv-show.R                1       1  0.00%    16
R/qenv-within.R             95      95  0.00%    3-150
R/utils.R                   19       0  100.00%
TOTAL                      299     105  64.88%

Diff against main

Filename           Stmts    Miss  Cover
---------------  -------  ------  --------
R/qenv-within.R      +95     +95  +100.00%
TOTAL                +95     +95  -30.22%

Results for commit: 260ae9f

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions

github-actions Bot commented Oct 2, 2023

Copy link
Copy Markdown
Contributor

Unit Tests Summary

    1 files      8 suites   2s ⏱️
  66 tests   66 ✔️ 0 💤 0
144 runs  144 ✔️ 0 💤 0

Results for commit 94f6647.

@chlebowa

chlebowa commented Oct 3, 2023

Copy link
Copy Markdown
Contributor Author

Since we want to store code as is, it becomes an issue to perform substitution properly. Code coming in (whether it's through expr or code) is stored in the @code slot and only then converted into single calls which are substituted with values from ... and evaluated.

@chlebowa

chlebowa commented Oct 3, 2023

Copy link
Copy Markdown
Contributor Author

A solution has been proposed 👍

@chlebowa chlebowa closed this Oct 4, 2023
@chlebowa
chlebowa deleted the 127_qenv_within@main branch October 4, 2023 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce within.qenv

1 participant