r-lib / lintr

Static Code Analysis for R
https://lintr.r-lib.org
Other
1.2k stars 187 forks source link

lint_dir fails to work in this repo using .lintr file #2570

Closed henrykironde closed 6 months ago

henrykironde commented 6 months ago

Clone this directory and run lintr::lint_dir().

lintr::lint_dir()
Error: Malformed config file, ensure it ends in a newline
  Malformed config setting 'linters'
  invalid for() loop sequence
> 
MichaelChirico commented 6 months ago

can you share the config in question? thanks.

btw you might prefer a .lintr.R file to write the config as R code

henrykironde commented 6 months ago

The code is in this repository https://github.com/r-lib/lintr/blob/main/.lintr

MichaelChirico commented 6 months ago

I don't think lint_dir() is expected to work on our repo, we include many examples under tests/testthat of code that may not even parse as part of regression testing for {lintr}.

e.g. I get a different error from you:

# lint_dir()
#   |===                                                                   |   4%
Error: /home/michael/github/lintr/lintr.Rcheck/00_pkg_src/lintr/tests/testthat/dummy_projects/project/mismatched_starts_ends.R has 3 range starts (lines 3, 7, 11) but only 2 range ends (lines 1, 9) for exclusion from linting!

lint_package() runs fine.