I had a stray = in the middle of a large file, the linting error was pretty arcane. MRE:
s <- '
foo(
x,
key = y["key"],
= l$key
)'
writeLines(s, tmp <- tempfile())
Compare:
parse(tmp)
# Error in parse(tmp) :
# /tmp/Rtmpag3DPy/file33c5731c590bf5:5:3: unexpected '='
# 4: key = y["key"],
# 5: =
# ^
lintr::get_source_expressions(tmp)
# Error in vapply(eq_assign_locs, next_with_parent, pc = pc, integer(1)) :
# values must be length 1,
# but FUN(X[[1]]) result is length 0