extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
197 stars 27 forks source link

refactor cargo-processx functions #397

Closed kbvernon closed 23 hours ago

kbvernon commented 4 days ago

This PR tries to bring consistency to how functions call processx::run(). The main goal is to unburden this package by letting processx do the heavy lifting wherever possible. Changes include:

At the same time, I took the liberty of adding standalone type checks, reformatting to ensure scripts past lintr tests, removing magrittr pipes, and replacing redundant code.

Right now, there are seven files with calls to processx::run(), but I only updated four of them:

I'm ignoring cran-compliance.R because I think Josiah's recent work will make that code obsolete. I think the myriad issues in source.R are substantial enough that they call for their own PR. And the call in utils.R is only really there to check for third party cargo tools, so maybe not worth messing with.

JosiahParry commented 23 hours ago

codcov is being a bit extreme here. We can address the coverage later on. It is actually penalizing this PR for adding more checks funnily enough.

Good work @kbvernon

codecov[bot] commented 23 hours ago

Codecov Report

Attention: Patch coverage is 52.80899% with 84 lines in your changes missing coverage. Please review.

Project coverage is 80.31%. Comparing base (d8689d9) to head (d46ee51). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
R/license_note.R 0.00% 69 Missing :warning:
R/run_cargo.R 72.22% 10 Missing :warning:
R/clean.R 88.46% 3 Missing :warning:
R/read_cargo_metadata.R 94.44% 1 Missing :warning:
R/use_crate.R 95.45% 1 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/extendr/rextendr/pull/397/graphs/tree.svg?width=650&height=150&src=pr&token=5H6ID0LAO7&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr)](https://app.codecov.io/gh/extendr/rextendr/pull/397?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr) | [Files with missing lines](https://app.codecov.io/gh/extendr/rextendr/pull/397?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr) | Coverage Δ | | |---|---|---| | [R/find\_extendr.R](https://app.codecov.io/gh/extendr/rextendr/pull/397?src=pr&el=tree&filepath=R%2Ffind_extendr.R&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr#diff-Ui9maW5kX2V4dGVuZHIuUg==) | `100.00% <ø> (ø)` | | | [R/utils.R](https://app.codecov.io/gh/extendr/rextendr/pull/397?src=pr&el=tree&filepath=R%2Futils.R&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr#diff-Ui91dGlscy5S) | `100.00% <100.00%> (ø)` | | | [R/read\_cargo\_metadata.R](https://app.codecov.io/gh/extendr/rextendr/pull/397?src=pr&el=tree&filepath=R%2Fread_cargo_metadata.R&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr#diff-Ui9yZWFkX2NhcmdvX21ldGFkYXRhLlI=) | `95.23% <94.44%> (-4.77%)` | :arrow_down: | | [R/use\_crate.R](https://app.codecov.io/gh/extendr/rextendr/pull/397?src=pr&el=tree&filepath=R%2Fuse_crate.R&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr#diff-Ui91c2VfY3JhdGUuUg==) | `97.61% <95.45%> (-2.39%)` | :arrow_down: | | [R/clean.R](https://app.codecov.io/gh/extendr/rextendr/pull/397?src=pr&el=tree&filepath=R%2Fclean.R&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr#diff-Ui9jbGVhbi5S) | `82.50% <88.46%> (+12.32%)` | :arrow_up: | | [R/run\_cargo.R](https://app.codecov.io/gh/extendr/rextendr/pull/397?src=pr&el=tree&filepath=R%2Frun_cargo.R&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr#diff-Ui9ydW5fY2FyZ28uUg==) | `72.22% <72.22%> (ø)` | | | [R/license\_note.R](https://app.codecov.io/gh/extendr/rextendr/pull/397?src=pr&el=tree&filepath=R%2Flicense_note.R&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr#diff-Ui9saWNlbnNlX25vdGUuUg==) | `0.00% <0.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/extendr/rextendr/pull/397/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=extendr)

🚨 Try these New Features: