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

193 bring get_code_dependency from teal.code #194

Merged
merged 2 commits into from
Nov 22, 2023
Merged

Conversation

m7pr
Copy link
Contributor

@m7pr m7pr commented Nov 21, 2023

Close #193

Potentially improve with #192

Removal in teal.code insightsengineering/teal.code#167

Copy link
Contributor

badge

Code Coverage Summary

Filename                                 Stmts    Miss  Cover    Missing
-------------------------------------  -------  ------  -------  -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
R/as_cdisc.R                                39       4  89.74%   99-102
R/Callable.R                                45       0  100.00%
R/CallableCode.R                            36       2  94.44%   26, 63
R/CallableFunction.R                        88       3  96.59%   159-161
R/CallablePythonCode.R                      58      58  0.00%    21-227
R/cdisc_data.R                              41       1  97.56%   55
R/cdisc_join_keys.R                         11      11  0.00%    17-35
R/CDISCTealDataConnector.R                  20       3  85.00%   31, 36, 49
R/CDISCTealDataset.R                        46      11  76.09%   108-115, 204-206
R/CDISCTealDatasetConnector.R               26       1  96.15%   116
R/CodeClass.R                              111       1  99.10%   157
R/data_label.R                              36      13  63.89%   33-37, 56-63, 103
R/datanames.R                               11       0  100.00%
R/deep_clone_r6.R                            9       0  100.00%
R/dummy_function.R                           5       1  80.00%   23
R/formatters_var_labels.R                   49      21  57.14%   30, 38, 43-44, 46, 53, 99, 129-151
R/get_attrs.R                                2       2  0.00%    12-45
R/get_code.R                               173      19  89.02%   87, 140-143, 196-197, 207-208, 266, 297, 333, 337, 372, 381-385
R/get_dataname.R                             5       1  80.00%   39
R/get_dataset_label.R                        3       0  100.00%
R/get_dataset.R                             13       8  38.46%   39, 55, 80-86
R/get_datasets.R                            11       3  72.73%   96, 116, 140
R/get_join_keys.R                           10       0  100.00%
R/get_key_duplicates.R                      37       7  81.08%   41-47, 54-55
R/get_keys.R                                15       7  53.33%   68-69, 126-146
R/get_raw_data.R                            24      11  54.17%   168-181
R/include_css_js.R                           9       1  88.89%   20
R/is_pulled.R                                4       0  100.00%
R/join_key.R                                32       0  100.00%
R/join_keys-c.R                             26       0  100.00%
R/join_keys-extract.R                      122       0  100.00%
R/join_keys-names.R                         15       0  100.00%
R/join_keys-parents.R                       28       0  100.00%
R/join_keys-print.R                         47       0  100.00%
R/join_keys-utils.R                         87       1  98.85%   130
R/join_keys.R                               23       0  100.00%
R/load_dataset.R                            25      18  28.00%   58-63, 87-186
R/MAETealDataset.R                         138      57  58.70%   53, 115, 153-208, 224-229, 236-245, 282, 323-339
R/mutate_dataset.R                          18       0  100.00%
R/set_args.R                                10       5  50.00%   34-38
R/teal_data-class.R                         23       1  95.65%   68
R/teal_data.R                               39       2  94.87%   32, 59
R/TealData.R                               233     114  51.07%   183, 210, 222-291, 335-342, 375-380, 382, 384-389, 391, 408-453
R/TealDataAbstract.R                       232      24  89.66%   72, 85-88, 97-106, 215-218, 429, 454-458, 480, 486
R/TealDataConnection.R                     297     180  39.39%   58-59, 64, 67, 70, 106-163, 183, 186-188, 194-200, 205-207, 233, 238, 254-277, 287, 300, 321, 325-330, 333-336, 358-360, 364-371, 374-377, 392-406, 425-426, 446-517, 535-543, 545, 549-564, 567-570, 602, 608-612, 626, 661-663, 672-674
R/TealDataConnector.R                      196     102  47.96%   178, 190, 194, 207, 210-219, 221, 229-238, 321-325, 383-488
R/TealDataset.R                            367      23  93.73%   141-151, 382-386, 442-451, 503
R/TealDatasetConnector_constructors.R      270      52  80.74%   177-214, 727-732, 930-1006
R/TealDatasetConnector.R                   326      90  72.39%   169, 237, 251, 256, 270, 433, 456-495, 525, 540-570, 660, 670, 679-686, 699, 714-741
R/testhat-helpers.R                         54       0  100.00%
R/to_relational_data.R                      57       8  85.96%   34-35, 39, 98, 105, 111, 122-123
R/topological_sort.R                        32       0  100.00%
R/utils-code_dependency.R                  190       7  96.32%   37, 42, 252-253, 317-320
R/utils.R                                   56       9  83.93%   22-23, 27, 76-83
R/validate_data_args.R                      32       0  100.00%
R/zzz.R                                     11      11  0.00%    4-19
TOTAL                                     3923     893  77.24%

Diff against main

Filename                     Stmts    Miss  Cover
-------------------------  -------  ------  -------
R/utils-code_dependency.R     +190      +7  +96.32%
TOTAL                         +190      +7  +0.97%

Results for commit: 7265237

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Copy link
Contributor

Unit Tests Summary

       1 files       37 suites   15s ⏱️
   469 tests    468 ✔️ 1 💤 0
1 087 runs  1 086 ✔️ 1 💤 0

Results for commit 7265237.

Copy link
Contributor

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
code_dependency 👶 $+0.31$ $+31$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
code_dependency 👶 $+0.01$ Can_t_detect_occurrence_of_function_definition_when_a_formal_is_named_the_same_as_a_function
code_dependency 👶 $+0.01$ _linksto_cause_to_return_this_line_for_affected_binding
code_dependency 👶 $+0.01$ _linksto_gets_extracted_if_it_s_a_side_effect_on_a_dependent_object
code_dependency 👶 $+0.02$ _linksto_gets_extracted_if_it_s_a_side_effect_on_a_dependent_object_of_a_dependent_object
code_dependency 👶 $+0.01$ _linksto_returns_this_line_for_affected_binding_even_if_object_is_not_specificed_created_in_the_same_eval_code
code_dependency 👶 $+0.01$ _linksto_returns_this_line_for_affected_binding_if_object_is_not_specificed_in_the_same_element_of_code
code_dependency 👶 $+0.01$ _linksto_tag_indicate_affected_object_if_object_is_assigned_anywhere_in_a_code
code_dependency 👶 $+0.01$ get_code_dependency_can_extract_the_code_when_function_creates_an_object_which_is_used_only_on_rhs
code_dependency 👶 $+0.01$ get_code_dependency_can_extract_the_code_when_using_
code_dependency 👶 $+0.01$ get_code_dependency_can_t_extract_the_code_when_no_assign_operator
code_dependency 👶 $+0.01$ get_code_dependency_detects_cooccurrence_properly_even_if_all_objects_are_on_rhs
code_dependency 👶 $+0.01$ get_code_dependency_detects_every_assign_calls_even_if_not_evaluated
code_dependency 👶 $+0.01$ get_code_dependency_detects_occurrence_of_the_function_object
code_dependency 👶 $+0.02$ get_code_dependency_extract_code_of_a_binding_from_a_simple_code_put_in_a_character
code_dependency 👶 $+0.01$ get_code_dependency_extracts_code_of_a_parent_binding_but_only_those_evaluated_before_coocurence
code_dependency 👶 $+0.01$ get_code_dependency_extracts_code_of_a_parent_binding_if_used_as_an_arg_in_fun_call
code_dependency 👶 $+0.01$ get_code_dependency_ignores_effect_of_the_object_which_occurs_in_a_function_definition
code_dependency 👶 $+0.01$ get_code_dependency_ignores_occurrence_in_function_definition
code_dependency 👶 $+0.01$ get_code_dependency_ignores_occurrence_in_function_definition_without_curly_brackets
code_dependency 👶 $+0.01$ get_code_dependency_is_possible_to_output_the_code_for_multiple_objects
code_dependency 👶 $+0.07$ get_code_dependency_understands_usage_and_do_not_treat_rhs_of_as_objects_only_lhs_
code_dependency 👶 $+0.01$ get_code_dependency_warns_if_binding_doesn_t_exist_in_a_code
code_dependency 👶 $+0.01$ lines_affecting_parent_evaluated_after_co_occurrence_are_not_included_in_get_code_dependency_output
code_dependency 👶 $+0.02$ lines_affecting_parent_evaluated_after_co_occurrence_are_not_included_in_get_code_dependency_output_when_using_linksto

Results for commit 738c833

♻️ This comment has been updated with latest results.

@m7pr m7pr requested review from chlebowa and gogonzo November 21, 2023 10:20
@m7pr m7pr merged commit 40438e4 into main Nov 22, 2023
23 checks passed
@m7pr m7pr deleted the 193_get_code_dependency@main branch November 22, 2023 09:26
m7pr added a commit that referenced this pull request Nov 24, 2023
Close #182 

### Feature description
- Added `@verified` slot to `teal_data` class. 
- When object is initialized with empty `data` and `code` then
`verified` is equal to `TRUE`.
- If `data` or `code` are not-empty then `verified` is set to `FALSE`.
- Introduced `verify` 
    - S4 generic for `teal_data` and `qenv.error` classes.
    - Checks if you can reproduce `teal_data@env` with `teal_data@code`.
    - Sets `teal_data@verified` to TRUE if you can. 
    - Throws an error other way.  
- For `qenv.error` throwns an error with `object@message` information.
- Introduced `get_code` S4 generic for `teal_data` object
- `datanames` parameter allows to use `get_code_dependency(code, names)`
to get the code for specific objects.
- `get_code_dependency` was moved from `teal.code`
#194
- Introduced `show,teal_data-method`
    - adds message to the print for 
        - `teal_data@verified = FALSE` saying object **is not** verified
        - `teal_data@verified = TRUE` saying object **is** verified


### Not included
I did not provide a mechanism to block manual change of `@valid` slot,
as we do not have this for `@code` / `@env` anyway.

#### TODO
- [x] add `get_code.teal_data()` S3 method
- [x] rewrite `is_reproducible` to `S4 generic with method for teal_data
and for qenv.error.`
- [x] keep looking for a better name than `is_reproducible`
#189
- [x] write `teal.data::get_code` S4 for `teal_data` object
- [x] bring `get_code_dependency` from `teal.code` to `teal.data`
#194
- [x] improve and simplify error statements
#188 (comment)
- [ ] fix documentation suggestions
- [x] extend warnings for 3 scenarios of difference between code results
and objects in `@env`

---------

Signed-off-by: Marcin <[email protected]>
Signed-off-by: Pawel Rucki <[email protected]>
Signed-off-by: Aleksander Chlebowski <[email protected]>
Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Aleksander Chlebowski <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Aleksander Chlebowski <[email protected]>
Co-authored-by: André Veríssimo <[email protected]>
Co-authored-by: Pawel Rucki <[email protected]>
Co-authored-by: pawelru <[email protected]>
Co-authored-by: go_gonzo <[email protected]>
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.

Bring get_code_dependency from teal.code to teal.data
2 participants