Refactoring with checkmate and rlang#548
Conversation
|
This looks like it will make all of the code more consistent. Thank you!. Please merge in the current origin/main branch and resolve the conflicts. Also, for many of the checkmate calls, you've added |
…ng-refactor # Conflicts: # R/001-add.interval.col.R # R/PKNCA.options.R # R/assertions.R # R/auc.R # R/aucint.R # R/class-PKNCAdata.R # R/class-PKNCAdose.R # R/class-general.R # R/class-summary_PKNCAresults.R # R/exclude.R # R/interpolate.conc.R # R/pk.calc.all.R # R/pk.calc.c0.R # R/superposition.R # R/tss.R # R/tss.monoexponential.R # R/tss.stepwise.linear.R # tests/testthat/test-PKNCA.options.R
| end, | ||
| interval[2] | ||
| ), | ||
| class = "pknca_error_interval_mismatch" |
There was a problem hiding this comment.
Please make sure that all class values differ. This is the same as the one a few lines above, and part of the goal of setting the classes is to be able to differentiate errors by class for programmatic capturing by other tools (e.g. ANCA or ruminate).
| # stricter. | ||
| stop(unit_col, call. = FALSE) | ||
| rlang::abort( | ||
| message = conditionMessage(attr(unit_col, "condition")), |
There was a problem hiding this comment.
conditionMessage() here seems like it is not required. Please remove it or let me know why it is necessary.
| if ("auc.type" %in% names(list(...))) | ||
| stop("auc.type cannot be changed when calling pk.calc.auc.inf, please use pk.calc.auc") | ||
| rlang::abort( | ||
| message = paste( |
There was a problem hiding this comment.
Please do not use paste() as that can make finding the error message harder to diagnose problems.
| if ("auc.type" %in% names(list(...))) | ||
| stop("auc.type cannot be changed when calling pk.calc.auc.all, please use pk.calc.auc") | ||
| rlang::abort( | ||
| message = paste( |
There was a problem hiding this comment.
Same comment about not using paste. Please apply that throughout.
| "auc.type cannot be changed when calling pk.calc.aumc.all,", | ||
| "please use pk.calc.aumc" | ||
| ), | ||
| class = "pknca_error_aumc_type_override" |
There was a problem hiding this comment.
Please make the class unique here, too.
| #' quantification; this is used for AUCinf calculations. If provided as | ||
| #' `clast.obs` (observed clast value, default), AUCinf is AUCinf,obs. If | ||
| #' provided as `clast.pred`, AUCinf is AUCinf,pred. | ||
| #' provided as `clast.pred`, AUCinf is AUCinf,pred.#' |
There was a problem hiding this comment.
An extraneous #' was added to the end of this line. Please remove it.
|
|
||
| test_that("add.interval.col", { | ||
| # Invalid inputs fail | ||
| expect_error( |
There was a problem hiding this comment.
Please reinstate all of the tests where they are using the new regexp, if applicable. (You can remove the "info" part.)
|
Here are the comprehensive findings: Additional review findingsThese supplement the 6 inline comments already on the diff (non-unique classes, Severity token missing from some preexisting condition classes — breaks class-based captureThree internal "report a bug" errors are raised with a
Their siblings correctly use Negative-path tests deleted instead of migrated — coverage regressionPlease restore the tests to match the previous intent. Across ~10 test files, the
The new behavior is now less tested than the old. Please convert these to checkmate semantics quietly differ from the manual checks they replacedPlease add tests for where these tests are stricter: CI can't catch these because the negative tests (finding 2) were deleted. All verified against base:
None look dangerous, but they're undocumented behavior changes with no test pinning them. Please find remaining stop and warning calls"Replaced all
|
No description provided.