Skip to content

Using exclude: in .lintr results in error #1401

@jabenninghoff

Description

@jabenninghoff

When using the 3.0.0 CRAN release of lintr, listing with the following .lintr file results in an unexpected error:

linters: linters_with_defaults(
    line_length_linter(100) 
  )
exclude: list(
    "bad.R" = list(
      1, # global exclusions are unnamed
      line_length_linter = 4:6
    )
  )

(adapted from the Get Started page)

Error message when running lint_dir():

$ Rscript -e 'lintr::lint_dir(".")'
Error in `[.data.frame`(rex::re_matches(lines, exclude, locations = TRUE),  : 
  undefined columns selected
Calls: <Anonymous> ... do.call -> <Anonymous> -> lapply -> FUN -> [ -> [.data.frame
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions