Setting up lintr with CI

285 views Asked by At

I've been unsucessfully trying to setup lintr package with GitHub actions (circleCi would be good too, since it's a private repo) to check PR and pushes.

My project is a book so i don't need package build checks, but only enforcing style since there are serveral authors.

I've read this readme and this article but i couldn't figure out what should a .yml file look like is this case.

1

There are 1 answers

0
Alberson Miranda On BEST ANSWER

Figured that out. Still need to cache lintr but at least it is working:

on:
  push:
    branches:
      - master

  pull_request:
    branches:
      - master

name: lint

jobs:
  lint:
    runs-on: macOS-latest
    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - uses: actions/checkout@v2

      - uses: r-lib/actions/setup-r@master

      - name: Install lintr
        run: install.packages("lintr")
        shell: Rscript {0}

      - name: Lint

        run: lintr::lint_dir(linters = lintr::with_defaults(assignment_linter = NULL, line_length_linter = NULL, spaces_left_parentheses_linter = NULL), pattern = '[.]R$|[.]Rmd')
        shell: Rscript {0}