Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using exclude: in .lintr results in error #1401

Closed
jabenninghoff opened this issue Jun 17, 2022 · 2 comments · Fixed by #1410
Closed

Using exclude: in .lintr results in error #1401

jabenninghoff opened this issue Jun 17, 2022 · 2 comments · Fixed by #1410

Comments

@jabenninghoff
Copy link

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
@AshesITR AshesITR added bug an unexpected problem or unintended behavior and removed bug an unexpected problem or unintended behavior labels Jun 17, 2022
@AshesITR
Copy link
Collaborator

Hi @jabenninghoff. You're looking for exclusions: list(...).
exclude: ... modifies the regex used for the in-file exclusion syntax.

@AshesITR
Copy link
Collaborator

Sorry for the premature closure - thanks for reporting this bug in the documentation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants