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

How to apply lintr to package, linting not working (? #1697

Closed
latot opened this issue Oct 13, 2022 · 5 comments
Closed

How to apply lintr to package, linting not working (? #1697

latot opened this issue Oct 13, 2022 · 5 comments

Comments

@latot
Copy link

latot commented Oct 13, 2022

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!

@MichaelChirico
Copy link
Collaborator

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.

@latot
Copy link
Author

latot commented Oct 13, 2022

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.

@MichaelChirico
Copy link
Collaborator

@IndrajeetPatil
Copy link
Collaborator

I wish this would be merged soon. Because then users can just do:

usethis::use_github_action("lint-changed-files")

@MichaelChirico
Copy link
Collaborator

The PR mentioned by Indrajeet is now merged; please open a new issue if there's further uncertainty here.

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

No branches or pull requests

3 participants