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

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

Closed
dave-lovell opened this issue Sep 12, 2023 · 2 comments · Fixed by #2151
Closed

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

dave-lovell opened this issue Sep 12, 2023 · 2 comments · Fixed by #2151
Labels
good first issue ❤️ good issue for first-time contributors rmd

Comments

@dave-lovell
Copy link
Contributor

dave-lovell commented Sep 12, 2023

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

@MichaelChirico MichaelChirico added the good first issue ❤️ good issue for first-time contributors label Sep 12, 2023
@dave-lovell
Copy link
Contributor Author

I've fixed this with: #2151

@dave-lovell
Copy link
Contributor Author

I have not fixed this lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue ❤️ good issue for first-time contributors rmd
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants