From 8b37aa4b0da122bb7ba27406ef7f6e1d875b2284 Mon Sep 17 00:00:00 2001 From: Laurent BEAULATON Date: Fri, 25 Oct 2024 20:06:37 +0200 Subject: [PATCH] fix #278 --- R/inflate-utils.R | 2 +- R/inflate.R | 2 +- tests/testthat/test-inflate-part1.R | 10 +++++----- tests/testthat/test-inflate-part2.R | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/inflate-utils.R b/R/inflate-utils.R index 78211d2d..f54ccbdc 100644 --- a/R/inflate-utils.R +++ b/R/inflate-utils.R @@ -284,7 +284,7 @@ parse_test <- function(x, pkg, relative_flat_file) { # x <- rmd_test[1,] } lines <- c( - sprintf("# WARNING - Generated by {fusen} from %s: do not edit by hand\n", relative_flat_file), + sprintf("# WARNING - Generated by {fusen} from %s: do not edit by hand # nolint: line_length_linter.\n", relative_flat_file), x[["code"]][[1]] ) write_utf8(path = test_file, lines = lines) diff --git a/R/inflate.R b/R/inflate.R index e7aaef3c..38b9358d 100644 --- a/R/inflate.R +++ b/R/inflate.R @@ -547,7 +547,7 @@ create_r_files <- function(fun_code, pkg, relative_flat_file) { cli::cli_alert_warning(paste(basename(r_file), "has been overwritten")) } lines <- c( - sprintf("# WARNING - Generated by {fusen} from %s: do not edit by hand\n", relative_flat_file), + sprintf("# WARNING - Generated by {fusen} from %s: do not edit by hand # nolint: line_length_linter.\n", relative_flat_file), unlist(fun_code[x, ][["code_example"]]) ) write_utf8(path = r_file, lines = lines) diff --git a/tests/testthat/test-inflate-part1.R b/tests/testthat/test-inflate-part1.R index 9f0f7456..c4b53bb4 100644 --- a/tests/testthat/test-inflate-part1.R +++ b/tests/testthat/test-inflate-part1.R @@ -80,14 +80,14 @@ usethis::with_project(dummypackage, { test_that("inflate - R files contents are ok", { # examples in R files my_median_lines <- readLines(my_median_file) - expect_equal(my_median_lines[1], "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand") + expect_equal(my_median_lines[1], "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.") expect_true(all(my_median_lines[12:14] == c( "#' @examples", "#' my_median(2:20)", "#' my_median(1:12)" ))) my_other_median_lines <- readLines(my_other_median_file) - expect_equal(my_other_median_lines[1], "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand") + expect_equal(my_other_median_lines[1], "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.") expect_true(all(my_other_median_lines[12:15] == c( "#' @examples", "#' my_other_median(1:12)", @@ -117,7 +117,7 @@ usethis::with_project(dummypackage, { # _no roxygen at all my_norox_lines <- readLines(my_noroxfunctionfile) expect_true(all(my_norox_lines == c( - "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand", + "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.", "", "#' @noRd", "my_norox <- function(x) {", @@ -130,7 +130,7 @@ usethis::with_project(dummypackage, { expect_equal( my_norox2_lines, c( - "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand", + "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.", "", "#' @noRd", "#' @examples", @@ -192,7 +192,7 @@ usethis::with_project(dummypackage, { expect_equal( test_lines, c( - "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand", + "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.", "", "test_that(\"my_median works properly and show error if needed\", {", " expect_error(my_median(\"text\"))", diff --git a/tests/testthat/test-inflate-part2.R b/tests/testthat/test-inflate-part2.R index b49bd8c2..9c66f097 100644 --- a/tests/testthat/test-inflate-part2.R +++ b/tests/testthat/test-inflate-part2.R @@ -1207,7 +1207,7 @@ usethis::with_project(dummypackage, { expect_equal( lines, c( - "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand", + "# WARNING - Generated by {fusen} from dev/flat_full.Rmd: do not edit by hand # nolint: line_length_linter.", "", "#' my_twoexamples", "#' @param x x",