Skip to content

Commit

Permalink
fix #278
Browse files Browse the repository at this point in the history
  • Loading branch information
LBeaulaton committed Oct 25, 2024
1 parent ec8968c commit 8b37aa4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/inflate-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/inflate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-inflate-part1.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -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) {",
Expand All @@ -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",
Expand Down Expand Up @@ -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\"))",
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-inflate-part2.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8b37aa4

Please sign in to comment.