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

Closes #219 Uses {withr} to create temporary files and graceful handling of Suggests #220

Merged
merged 8 commits into from
Feb 19, 2024

Conversation

averissimo
Copy link
Collaborator

Thank you for your Pull Request!

We have developed a Pull Request template to aid you and our reviewers. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the xportr codebase remains robust and consistent.

The scope of {xportr}

{xportr}'s scope is to enable R users to write out submission compliant xpt files that can be delivered to a Health Authority or to downstream validation software programs. We see labels, lengths, types, ordering and formats from a dataset specification object (SDTM and ADaM) as being our primary focus. We also see messaging and warnings to users around applying information from the specification file as a primary focus. Please make sure your Pull Request meets this scope of {xportr}. If your Pull Request moves beyond this scope, please get in touch with the {xportr} team on slack or create an issue to discuss.

Please check off each task box as an acknowledgment that you completed the task. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the devel branch until you have checked off each task.

Changes Description

  • Convert all instances of tmpfile and tmpdir
    • To withr::local_file / withr::local_tempfile

Task List

  • The spirit of xportr is met in your Pull Request
  • Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
  • Summary of changes filled out in the above Changes Description. Can be removed or left blank if changes are minor/self-explanatory.
  • Code is formatted according to the tidyverse style guide. Use styler package and functions to style files accordingly.
  • Updated relevant unit tests or have written new unit tests. See our Wiki for conventions used in this package.
  • Creation/updated relevant roxygen headers and examples. See our Wiki for conventions used in this package.
  • Run devtools::document() so all .Rd files in the man folder and the NAMESPACE file in the project root are updated appropriately
  • Run pkgdown::build_site() and check that all affected examples are displayed correctly and that all new/updated functions occur on the "Reference" page.
  • Update NEWS.md if the changes pertain to a user-facing function (i.e. it has an @export tag) or documentation aimed at users (rather than developers)
  • Make sure that the pacakge version in the NEWS.md and DESCRIPTION file is same. Don't worry about updating the version because it will be auto-updated using the vbump.yaml CI.
  • Address any updates needed for vignettes and/or templates
  • Link the issue Development Panel so that it closes after successful merging.
  • Fix merge conflicts
  • Pat yourself on the back for a job well done! Much love to your accomplishment!

Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (37c520e) 100.00% compared to head (7a523e0) 99.82%.
Report is 50 commits behind head on main.

❗ Current head 7a523e0 differs from pull request most recent head 1c9f556. Consider uploading reports for the commit 1c9f556 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##              main     #220      +/-   ##
===========================================
- Coverage   100.00%   99.82%   -0.18%     
===========================================
  Files           14       12       -2     
  Lines          665      583      -82     
===========================================
- Hits           665      582      -83     
- Misses           0        1       +1     

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

@averissimo averissimo changed the title Closes #219 Uses withr::local_file to create temporary files that are deleted Closes #219 Uses withr::local_file to create temporary files Jan 17, 2024
@@ -618,7 +618,9 @@ test_that("xportr_*: Domain is kept in between calls", {
# Divert all messages to tempfile, instead of printing them
# note: be aware as this should only be used in tests that don't track
# messages
withr::local_message_sink(tempfile())
if (requireNamespace("withr", quietly = TRUE)) {
Copy link
Collaborator Author

@averissimo averissimo Jan 17, 2024

Choose a reason for hiding this comment

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

ℹ️ Following CRAN guidelines: https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Suggested-packages

Although {withr} is a required secondary depencency, so (for now) it's very difficult to run tests without having {withr} installed

{vroom} and {tidyselect} import {withr}

@averissimo averissimo changed the title Closes #219 Uses withr::local_file to create temporary files Closes #219 Uses {withr} to create temporary files Jan 17, 2024
Comment on lines +104 to +112
data_to_save(),
domain = "data_to_save",
path = withr::local_file("xyz.xpt"),
metadata = data.frame(
dataset = "data_to_save",
label = "çtestç"
)
)
),
"`label` cannot contain any non-ASCII, symbol or special characters"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ℹ️ Problem detected with missing test coverage. (recursive call of xportr_write)
ℹ️ Adds exact error that is expected (test was passing, but outputing the wrong error)

note: I can separate this from this PR, just let me know if this is too out of scope

Copy link
Collaborator

Choose a reason for hiding this comment

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

@EeethB was this the same as the testing issue in the other PR - with the lack of coverage?? or separate issue? IF not, @averissimo I think this can be handled in this PR.

I like the word graceful in the PR titile

@averissimo averissimo changed the title Closes #219 Uses {withr} to create temporary files Closes #219 Uses {withr} to create temporary files and graceful handling of Suggests Jan 17, 2024
@averissimo averissimo marked this pull request as draft January 23, 2024 16:41
@averissimo
Copy link
Collaborator Author

Postponing until pending PRs are merged

@EeethB
Copy link
Collaborator

EeethB commented Feb 1, 2024

Should we address this comment about suppressMessages() in this PR?

#200 (comment)

@bms63
Copy link
Collaborator

bms63 commented Feb 13, 2024

@averissimo I think we can finish this one off now that most of the function work is done.

We got a few merge conflicts.

@sadchla-codes is working on #223 so I think there might be some overlap between the two issues.

* origin/main: (199 commits)
  [skip actions] Bump version to 0.3.1.9018
  corrects typo
  chore: #221 update spelling
  ci: remove admiral string that was helping identifying action on UI
  revert deliberate errors
  Trigger CI
  ci: reusing workflows from admiralci
  [skip actions] Bump version to 0.3.1.9017
  [skip actions] Bump version to 0.3.1.9016
  Update pull_request_template.md
  chore: removed duplicated documentation section in news
  chore: breaking news - turn to channel 6!
  docs: #192 remove non-user functions from reference files
  docs: #230 #188 PR template tweaks
  [skip actions] Bump version to 0.3.1.9015
  lint:reduce lenght of line
  Reduce line length less than 120 characters
  Update NEWS.md
  change argument name to length_source
  Change argument name to source_length in test-length
  ...
@averissimo averissimo marked this pull request as ready for review February 15, 2024 17:40
@bms63 bms63 merged commit d083631 into main Feb 19, 2024
29 checks passed
@bms63 bms63 deleted the 219-withr branch February 19, 2024 13:22
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.

Use {withr} to create temporary files (that are automatically deleted) in tests
3 participants