From 4477299fb321fd10647371732aa61d902b264af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Fri, 21 Aug 2026 12:17:56 +0200 Subject: [PATCH 1/5] chore: seq --- R/glet.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/glet.R b/R/glet.R index be7843b6c28..28917e03e63 100644 --- a/R/glet.R +++ b/R/glet.R @@ -123,7 +123,7 @@ graphlets.candidate.basis <- function(graph, weights = NULL) { #' gl <- graphlets(g, niter = 1000) #' #' ## Plot graphlets -#' for (i in 1:length(gl$cliques)) { +#' for (i in seq_along(gl$cliques)) { #' sel <- gl$cliques[[i]] #' V(g)$color <- "white" #' V(g)[sel]$color <- "#E495A5" From d0a4a391e760235226209fa8e24073e86755ba2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Fri, 21 Aug 2026 12:18:09 +0200 Subject: [PATCH 2/5] chore: lengths --- R/operators.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/operators.R b/R/operators.R index 7b558ebcd61..e16c9378372 100644 --- a/R/operators.R +++ b/R/operators.R @@ -229,7 +229,7 @@ apply_attr_combiner <- function(comb, vals, type) { x <- x[!is.na(x)] apply_one_combiner(comb, x) }) - if (all(vapply(out, length, integer(1)) == 1L)) { + if (all(lengths(out) == 1L)) { unlist(out) } else { out From 6930b199853952c52775dba7c7234b7d12218c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Wed, 26 Aug 2026 12:24:44 +0200 Subject: [PATCH 3/5] chore: rm useless comments via `outdated_suppression` --- R/print.R | 1 - tests/testthat/test-attributes.R | 5 ----- tests/testthat/test-iterators.R | 1 - tests/testthat/test-plot.shapes.R | 1 - tests/testthat/test-structural-properties.R | 2 +- tests/testthat/test-weakref.R | 2 -- 6 files changed, 1 insertion(+), 11 deletions(-) diff --git a/R/print.R b/R/print.R index 1c2afaf9942..9c383aa4cea 100644 --- a/R/print.R +++ b/R/print.R @@ -373,7 +373,6 @@ print_edge_detail <- function(graph, edges) { if (!is.null(x)) { arrow <- c("--", "->")[is_directed(x) + 1] - # jarl-ignore unused_object: then assigned to with <<- can_max <- NA el <- NA diff --git a/tests/testthat/test-attributes.R b/tests/testthat/test-attributes.R index f46f03db367..2568534cb9c 100644 --- a/tests/testthat/test-attributes.R +++ b/tests/testthat/test-attributes.R @@ -11,17 +11,14 @@ test_that("bracketing works (not changing attribute of similar graphs)", { g <- make_graph(c(1, 2, 1, 3, 3, 4)) g <- set_vertex_attr(g, name = "weight", value = 1:vcount(g)) - # jarl-ignore unused_object: test design graph2 <- set_vertex_attr(g, name = "weight", value = rep(1, vcount(g))) expect_equal(vertex_attr(g, name = "weight"), 1:4) g <- set_edge_attr(g, name = "weight", value = 1:ecount(g)) - # jarl-ignore unused_object: test design graph2 <- set_edge_attr(g, name = "weight", value = rep(1, ecount(g))) expect_equal(edge_attr(g, name = "weight"), 1:3) g <- set_graph_attr(g, name = "name", "foo") - # jarl-ignore unused_object: test design graph2 <- set_graph_attr(g, name = "name", "foobar") expect_equal(graph_attr(g, name = "name"), "foo") }) @@ -41,7 +38,6 @@ test_that("bracketing works with a function (not changing attribute of similar g graph2 } - # jarl-ignore unused_object: test design g2 <- copy_test(g) expect_equal(vertex_attr(g, name = "weight"), 1:4) expect_equal(edge_attr(g, name = "weight"), 1:3) @@ -61,7 +57,6 @@ test_that("bracketing works with shortcuts (not changing attribute of similar gr graph$name <- "foobar" } - # jarl-ignore unused_object: test design g_copy <- copy_test(g) expect_equal(vertex_attr(g, name = "weight"), 1:4) expect_equal(edge_attr(g, name = "weight"), 1:3) diff --git a/tests/testthat/test-iterators.R b/tests/testthat/test-iterators.R index 59a6a274fee..b8940921c94 100644 --- a/tests/testthat/test-iterators.R +++ b/tests/testthat/test-iterators.R @@ -244,7 +244,6 @@ test_that("vs/es refers to the original graph", { vs <- V(ring1) es <- E(ring1) - # jarl-ignore unused_object: test design ring1 <- ring1 + 4 expect_identical(get_vs_graph(vs), ring2) diff --git a/tests/testthat/test-plot.shapes.R b/tests/testthat/test-plot.shapes.R index a424f96b7cd..9cb83f0596a 100644 --- a/tests/testthat/test-plot.shapes.R +++ b/tests/testthat/test-plot.shapes.R @@ -1,4 +1,3 @@ -# jarl-ignore-file implicit_assignment: just the way it works test_that("shapes() lists all available shapes", { all_shapes <- shapes() expect_type(all_shapes, "character") diff --git a/tests/testthat/test-structural-properties.R b/tests/testthat/test-structural-properties.R index 6c4e5752024..594d7ec0bf3 100644 --- a/tests/testthat/test-structural-properties.R +++ b/tests/testthat/test-structural-properties.R @@ -198,7 +198,7 @@ test_that("BFS callback does not blow up when an invalid value is returned", { }) test_that("BFS callback does not blow up when an error is raised within the callback", { - # jarl-ignore unreachable_code: + # jarl-ignore unreachable_code: test design callback <- function(graph, data, extra) { cli::cli_abort("test") FALSE diff --git a/tests/testthat/test-weakref.R b/tests/testthat/test-weakref.R index 8d4da9b23b2..de2a330f50c 100644 --- a/tests/testthat/test-weakref.R +++ b/tests/testthat/test-weakref.R @@ -27,9 +27,7 @@ test_that("weak reference finalizer is called", { value <- "foobar" hello <- "" fin <- function(env) hello <<- "world" - # jarl-ignore unused_object: test design vs <- make_weak_ref(key = g, value = value, finalizer = fin) - rm(g) gc() From de03e40b8f3ddd5fa606910329748d1f96fc9668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Wed, 26 Aug 2026 12:27:59 +0200 Subject: [PATCH 4/5] chore: jarl ignore missing argument --- tests/testthat/test-migration-fixture.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-migration-fixture.R b/tests/testthat/test-migration-fixture.R index 8746f9bd7be..7d9f4f82d45 100644 --- a/tests/testthat/test-migration-fixture.R +++ b/tests/testthat/test-migration-fixture.R @@ -1,3 +1,4 @@ +# jarl-ignore-file missing_argument: this is the test's point # Tests for the in-place argument-migration generator (tools/generate-migrations.R) # via the fixture `migration_fixture()` (R/migration-fixture.R). Old signature # f(graph, n, weight, kind, directed); new f(graph, n, ..., weights, type, From 9c03eecb3c511789d19d098dfb0fa70ba1e830e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Wed, 26 Aug 2026 12:37:57 +0200 Subject: [PATCH 5/5] chore: stringAsFactors --- R/conversion.R | 6 ++++-- R/print.R | 6 +++++- man/graph_from_data_frame.Rd | 6 ++++-- man/graphlet_basis.Rd | 2 +- tests/testthat/test-conversion.R | 18 ++++++++++++++---- tests/testthat/test-glet.R | 3 ++- tests/testthat/test-interface.R | 2 +- tests/testthat/test-sparsedf.R | 14 +++++++++----- 8 files changed, 40 insertions(+), 17 deletions(-) diff --git a/R/conversion.R b/R/conversion.R index 61791722a72..e6137baf3d0 100644 --- a/R/conversion.R +++ b/R/conversion.R @@ -1944,7 +1944,8 @@ graph.data.frame <- function(d, directed = TRUE, vertices = NULL) { #' "Esmeralda" #' ), #' age = c(48, 33, 45, 34, 21), -#' gender = c("F", "M", "F", "M", "F") +#' gender = c("F", "M", "F", "M", "F"), +#' stringsAsFactors = FALSE #' ) #' relations <- data.frame( #' from = c( @@ -1953,7 +1954,8 @@ graph.data.frame <- function(d, directed = TRUE, vertices = NULL) { #' ), #' to = c("Alice", "Bob", "Alice", "Alice", "Bob", "Alice"), #' same.dept = c(FALSE, FALSE, TRUE, FALSE, FALSE, TRUE), -#' friendship = c(4, 5, 5, 2, 1, 1), advice = c(4, 5, 5, 4, 2, 3) +#' friendship = c(4, 5, 5, 2, 1, 1), advice = c(4, 5, 5, 4, 2, 3), +#' stringsAsFactors = FALSE #' ) #' g <- graph_from_data_frame(relations, directed = TRUE, vertices = actors) #' print(g, e = TRUE, v = TRUE) diff --git a/R/print.R b/R/print.R index 9c383aa4cea..33f906cdb24 100644 --- a/R/print.R +++ b/R/print.R @@ -173,7 +173,11 @@ })) ) { ## create a table - tab <- data.frame(v = paste(sep = "", "[", ind, "]"), row.names = "v") + tab <- data.frame( + v = paste(sep = "", "[", ind, "]"), + row.names = "v", + stringsAsFactors = FALSE + ) for (i in list) { tab[i] <- vertex_attr(x, i, ind) } diff --git a/man/graph_from_data_frame.Rd b/man/graph_from_data_frame.Rd index f435b5f650d..9bd354f0d21 100644 --- a/man/graph_from_data_frame.Rd +++ b/man/graph_from_data_frame.Rd @@ -108,7 +108,8 @@ actors <- data.frame( "Esmeralda" ), age = c(48, 33, 45, 34, 21), - gender = c("F", "M", "F", "M", "F") + gender = c("F", "M", "F", "M", "F"), + stringsAsFactors = FALSE ) relations <- data.frame( from = c( @@ -117,7 +118,8 @@ relations <- data.frame( ), to = c("Alice", "Bob", "Alice", "Alice", "Bob", "Alice"), same.dept = c(FALSE, FALSE, TRUE, FALSE, FALSE, TRUE), - friendship = c(4, 5, 5, 2, 1, 1), advice = c(4, 5, 5, 4, 2, 3) + friendship = c(4, 5, 5, 2, 1, 1), advice = c(4, 5, 5, 4, 2, 3), + stringsAsFactors = FALSE ) g <- graph_from_data_frame(relations, directed = TRUE, vertices = actors) print(g, e = TRUE, v = TRUE) diff --git a/man/graphlet_basis.Rd b/man/graphlet_basis.Rd index a6e97086249..88ce6849e76 100644 --- a/man/graphlet_basis.Rd +++ b/man/graphlet_basis.Rd @@ -102,7 +102,7 @@ plot(g, layout = co) gl <- graphlets(g, niter = 1000) ## Plot graphlets -for (i in 1:length(gl$cliques)) { +for (i in seq_along(gl$cliques)) { sel <- gl$cliques[[i]] V(g)$color <- "white" V(g)[sel]$color <- "#E495A5" diff --git a/tests/testthat/test-conversion.R b/tests/testthat/test-conversion.R index b5014209aba..f366542d0fb 100644 --- a/tests/testthat/test-conversion.R +++ b/tests/testthat/test-conversion.R @@ -905,7 +905,8 @@ test_that("graph_from_data_frame works with factors", { actors <- data.frame( name = c("Alice", "Bob", "Cecil", "David", "Esmeralda"), age = c(48, 33, 45, 34, 21), - gender = factor(c("F", "M", "F", "M", "F")) + gender = factor(c("F", "M", "F", "M", "F")), + stringsAsFactors = FALSE ) relations <- data.frame( from = c( @@ -915,7 +916,8 @@ test_that("graph_from_data_frame works with factors", { to = c("Alice", "Bob", "Alice", "Alice", "Bob", "Alice"), same.dept = c(FALSE, FALSE, TRUE, FALSE, FALSE, TRUE), friendship = c(4, 5, 5, 2, 1, 1), - advice = c(4, 5, 5, 4, 2, 3) + advice = c(4, 5, 5, 4, 2, 3), + stringsAsFactors = FALSE ) g <- graph_from_data_frame(relations, directed = TRUE, vertices = actors) @@ -1188,8 +1190,16 @@ test_that("graph_from_adj_list() covers duplicate by name and recovers positiona }) test_that("graph_from_data_frame() recovers positional vertices with a deprecation", { - edges <- data.frame(from = c("a", "b"), to = c("b", "c")) - verts <- data.frame(name = c("a", "b", "c"), size = 1:3) + edges <- data.frame( + from = c("a", "b"), + to = c("b", "c"), + stringsAsFactors = FALSE + ) + verts <- data.frame( + name = c("a", "b", "c"), + size = 1:3, + stringsAsFactors = FALSE + ) lifecycle::expect_deprecated( res <- graph_from_data_frame(edges, TRUE, verts) diff --git a/tests/testthat/test-glet.R b/tests/testthat/test-glet.R index af039389da0..72d98df6a38 100644 --- a/tests/testthat/test-glet.R +++ b/tests/testthat/test-glet.R @@ -31,7 +31,8 @@ test_that("Graphlets filtering works", { df <- data.frame( from = c("A", "A", "B", "B", "B", "C", "C", "D"), to = c("B", "C", "C", "D", "E", "D", "E", "E"), - weight = c(8, 8, 8, 5, 5, 5, 5, 5) + weight = c(8, 8, 8, 5, 5, 5, 5, 5), + stringsAsFactors = FALSE ) g <- graph_from_data_frame( diff --git a/tests/testthat/test-interface.R b/tests/testthat/test-interface.R index a9c36f18c90..80c29e448f3 100644 --- a/tests/testthat/test-interface.R +++ b/tests/testthat/test-interface.R @@ -214,7 +214,7 @@ test_that("get_edge_id() errors correctly for wrong vp", { expect_error(get_edge_ids(g, NA)) V(g)$name <- letters[1:3] - df <- data.frame(from = c("a", "b"), to = c(1, 2)) + df <- data.frame(from = c("a", "b"), to = c(1, 2), stringsAsFactors = FALSE) expect_snapshot_igraph_error({ get_edge_ids(g, df) }) diff --git a/tests/testthat/test-sparsedf.R b/tests/testthat/test-sparsedf.R index f5298b186b2..ca7829f59e4 100644 --- a/tests/testthat/test-sparsedf.R +++ b/tests/testthat/test-sparsedf.R @@ -7,7 +7,7 @@ test_that("sdf works", { sdf <- sdf(id = 1:10, color = "black") expect_equal( as.data.frame(sdf), - data.frame(id = 1:10, color = "black") + data.frame(id = 1:10, color = "black", stringsAsFactors = FALSE) ) ## access @@ -26,28 +26,32 @@ test_that("sdf works", { sdf2[5, "id"] <- 100 expect_equal( as.data.frame(sdf2), - data.frame(id = c(1:4, 100, 6:10), color = "black") + data.frame( + id = c(1:4, 100, 6:10), + color = "black", + stringsAsFactors = FALSE + ) ) sdf2 <- sdf sdf2[, "id"] <- 0 expect_equal( as.data.frame(sdf2), - data.frame(id = rep(0, 10), color = "black") + data.frame(id = rep(0, 10), color = "black", stringsAsFactors = FALSE) ) sdf2 <- sdf sdf2[2:10, "id"] <- 1 expect_equal( as.data.frame(sdf2), - data.frame(id = rep(1, 10), color = "black") + data.frame(id = rep(1, 10), color = "black", stringsAsFactors = FALSE) ) sdf2 <- sdf sdf2[, "color"] <- "white" expect_equal( as.data.frame(sdf2), - data.frame(id = 1:10, color = "white") + data.frame(id = 1:10, color = "white", stringsAsFactors = FALSE) ) sdf2 <- sdf