lintr
lintr copied to clipboard
How to apply lintr to package, linting not working (?
Hi all, I has been using lintr from some months, is great, seems there is some changes but I notice something really weird, I uses this as the doc says to enable the linting and check it:
# in a package:
lintr::use_lintr(type = "tidyverse")
usethis::use_github_action("lint")
lintr::lint_package()
Before, when there was a warning, the linting failed in the github tests so we can fix it, but for some reason, now the warnings of lintr does not fail, all tests pass fine, but when we check the linting test, there is warnings D:
Maybe the workflow of lint
need an update? in that case would be nice to have a version 2 with it.
Thx!
Hi @latot, can you share more details, for example, the .yml of your GHA (is it GHA)?
please also check this package's own lint workflows for inspiration.
Okis!, seems I'm using the same as this project, don't know why the warnings pass D:
Yaml!
on:
push:
branches: [main]
pull_request:
branches: [main]
name: lint
jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint
- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
Note: Why opening the issue here? because, the idea of use usethis
to set up the linting, is to be ready just with that command, not start tweaking it to do it works.
please follow this one instead:
https://github.com/r-lib/lintr/blob/4b37029f989629287e910fa3aba46ab15d1975cb/.github/workflows/lint-changed-files.yaml
I wish this would be merged soon. Because then users can just do:
usethis::use_github_action("lint-changed-files")