## Keep parse data in non interactive sessions.
if (!interactive())
op <- options(keep.source = TRUE)
fil <- tempfile(fileext = ".R")
cat("MAX <- 2^6 - 1",
"MIN.INT <- 42L",
"99 -> ERROR__",
"size <- 42",
"x <- rnorm(MAX)",
"runif(123)",
"x[1]",
"x[1] * 7 + 2",
"x[33]",
"x * 100",
"x <- numeric(0)",
"y <- logical(5)",
file = fil, sep = "\n")
## Default list of ignored magic numbers
nomagic_style(getSourceData(fil))
## Additional exceptions
nomagic_style(getSourceData(fil), ignore.also = c(5, 42))
Run the code above in your browser using DataLab