Closed
Description
I am using r-lib/lintr version a32f2d2
, and the R version is 4.2.0
on macOS
suppose we have following test.rmd
file:
(I attach it as pastebin because rmarkdown syntax may conflict with github markdown syntax)
notably, an incomplete pip operator will fail
test = 10
test |>
and lintr::lint("test.rmd")
will yield following error:
Error in rep.int(character, length) : invalid 'times' value
traceback:
9: paste0(collapse = "", rep.int(character, length))
8: fill_with(" ", maximum)
7: highlight_string(x$message, x$column_number, x$ranges)
6: cat(sep = "", emph(x$filename, ":", as.character(x$line_number),
":", as.character(x$column_number), ": ", sep = ""), color(x$type,
": ", sep = ""), "[", x$linter, "] ", emph(x$message), "\n",
chartr("\t", " ", x$line), "\n", highlight_string(x$message,
x$column_number, x$ranges), "\n")
5: print.lint(X[[i]], ...)
4: FUN(X[[i]], ...)
3: lapply(x, print, ...)
2: print.lints(x)
1: (function (x, ...)
UseMethod("print"))(x)
also note, in R script an incomplete |>
will not issue an error, instead such error can be correctly linted:
lintr::lint("test.R")
r$> lintr::lint("test.R")
/Users/northyear/Downloads/test/test.R:21:6: error: [error] unexpected end of input
cat |>