--- a +++ b/.github/workflows/linter.yml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [dev, master, release-*] + pull_request: + branches: [dev, master] + +name: lint + +jobs: + lint: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + + - 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: | + library(lintr) + style_rules <- list( + T_and_F_symbol_linter(), assignment_linter(), brace_linter(), + commas_linter(), commented_code_linter(), todo_comment_linter(), + equals_na_linter(), + function_left_parentheses_linter(), infix_spaces_linter(), + line_length_linter(), whitespace_linter(), object_usage_linter(), + absolute_path_linter(), + nonportable_path_linter(), pipe_continuation_linter(), + semicolon_linter(), seq_linter(), quotes_linter(), + spaces_inside_linter(), spaces_left_parentheses_linter(), + trailing_blank_lines_linter(), trailing_whitespace_linter(), + undesirable_function_linter(), undesirable_operator_linter(), + unnecessary_concatenation_linter() + ) + lint_package(linters = style_rules) + shell: Rscript {0} + env: + LINTR_ERROR_ON_LINT: true