Skip to content

Commit e4ea7a3

Browse files
topeposimonpcouch
andauthored
Apply suggestions from code review
Co-authored-by: Simon P. Couch <[email protected]>
1 parent f79274b commit e4ea7a3

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

R/condense_control.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#'
2525
#' ctrl <- condense_control(ctrl, control_parsnip())
2626
#' str(ctrl)
27-
condense_control <- function(x, ref, call = rlang::caller_env()) {
27+
condense_control <- function(x, ref, ..., call = rlang::caller_env()) {
28+
check_dots_empty()
2829
mismatch <- setdiff(names(ref), names(x))
2930
if (length(mismatch)) {
3031
cli::cli_abort(

R/contr_one_hot.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ contr_one_hot <- function(n, contrasts = TRUE, sparse = FALSE) {
2525
}
2626

2727
if (is.character(n)) {
28-
check_character(n, empty = FALSE)
2928
if (length(n) < 1) {
30-
cli::cli_abort("A character vector for {.arg n} cannot be empty.")
29+
cli::cli_abort("{.arg n} cannot be empty.")
3130
}
3231
names <- n
3332
n <- length(names)

R/glmnet-engines.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ format_glmnet_multinom_class <- function(pred, penalty, lvl, n_obs) {
370370
{.pkg tune} package.",
371371
"i" = "To predict multiple penalties, use {.fn multi_predict}."
372372
),
373-
call = call)
373+
call = call
374+
)
374375
}
375376
}
376377

@@ -395,7 +396,8 @@ format_glmnet_multinom_class <- function(pred, penalty, lvl, n_obs) {
395396
"{.arg penalty} should be a single numeric value.",
396397
"i" = "{.fn multi_predict} can be used to get multiple predictions per row of data."
397398
),
398-
call = call)
399+
call = call
400+
)
399401
}
400402
}
401403

@@ -406,7 +408,8 @@ format_glmnet_multinom_class <- function(pred, penalty, lvl, n_obs) {
406408
{.arg object$fit$lambda}. Predicting with a value of {.arg penalty}
407409
will give incorrect results from `glmnet()`."
408410
),
409-
call = call)
411+
call = call
412+
)
410413
}
411414

412415
penalty

tests/testthat/test-condense_control.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ test_that("condense_control works", {
2525
invisible(control)
2626
}
2727
expect_snapshot(error = TRUE, control_test(ctrl))
28-
2928
})

tests/testthat/test-contr_one_hot.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
test_that('one-hot encoding contrasts', {
2-
32
contr_mat <- contr_one_hot(12)
43
expect_equal(colnames(contr_mat), paste(1:12))
54
expect_equal(rownames(contr_mat), paste(1:12))
@@ -17,5 +16,4 @@ test_that('one-hot encoding contrasts', {
1716
expect_snapshot(contr_one_hot(list()), error = TRUE)
1817
expect_snapshot(contr_one_hot(2, contrast = FALSE))
1918
expect_snapshot(contr_one_hot(2, sparse = TRUE))
20-
2119
})

tests/testthat/test-misc.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ test_that('parsnip objects', {
77
expect_false(has_multi_predict(lm_idea))
88
expect_snapshot(error = TRUE, predict(lm_idea, mtcars))
99

10-
1110
lm_fit <- fit(lm_idea, mpg ~ ., data = mtcars)
1211
expect_false(has_multi_predict(lm_fit))
1312
expect_false(has_multi_predict(extract_fit_engine(lm_fit)))

0 commit comments

Comments
 (0)