Closed
Description
Even after the documentation fix for #1401, when using the 3.0.0 CRAN release of lintr, implementing the example in https://lintr.r-lib.org/articles/lintr.html#excluding-lines-via-the-config-file results in an unexpected error:
linters: linters_with_defaults(
line_length_linter(100)
)
exclusions: list(
"bad.R" = list(
1, # global exclusions are unnamed
line_length_linter = 4:6
)
)
Error message when running lint_dir()
:
$ Rscript -e 'lintr::lint_dir(".")'
Error in file_exclusion[[names2(file_exclusion) == ""]] :
attempt to select less than one element in integerOneIndex
Calls: <Anonymous> ... drop_excluded -> vapply -> FUN -> is_excluded_file -> %in%
Execution halted
To reproduce: run Rscript -e 'lintr::lint_dir(".")'
from a directory containing the .lintr
file above, and the following bad.R
:
tmp = "value"
# regular comment
# really long comment ............................................................................................................
# really long comment ............................................................................................................
# really long comment ............................................................................................................
# regular comment