Skip to content

lint_dir() does not lint .qmd files by default #2150

Closed
@dave-lovell

Description

@dave-lovell

The documentation for lint_dir() claims that .qmd files are included in the default argument for 'pattern', but I have discovered that this is not the case. The default argument for patter is a rex()-generated regex that matches '.Rmd' and '.rmd', but neither '.qmd' nor '.Qmd'.

I would make a pull request but I find rex pretty confusing, and the default argument is already quite long.

Here is lint_dir() as documented. It's easy to see that there's no allowance made for qmd files:

lint_dir(
  path = ".",
  ...,
  relative_path = TRUE,
  exclusions = list("renv", "packrat"),
  pattern = rex::rex(".", one_of("Rr"), or("", "html", "md", "nw", "rst", "tex", "txt"),
    end),
  parse_settings = TRUE
)

And here is a worked example using the same regex:

lint_dir_regex <- rex::rex(".", one_of("Rr"), or("", "html", "md", "nw", "rst", "tex", "txt"), end)

# .rmd works:
stringr::str_detect(".rmd", lint_dir_regex)                                                      
#> [1] TRUE

# .qmd does not:
stringr::str_detect(".qmd", lint_dir_regex)
#> [1] FALSE

Created on 2023-09-12 with reprex v2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions