Skip to content

Commit

Permalink
Use lintr config file also in GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Jul 23, 2024
1 parent 409eafe commit 5208f36
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 54 deletions.
1 change: 0 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
with:
pak-version: devel
cache-version: 10
upgrade: 'TRUE'
extra-packages: |
any::rcmdcheck
Expand Down
34 changes: 7 additions & 27 deletions .github/workflows/lint-changed-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
pak-version: devel
upgrade: 'TRUE'
needs: check
extra-packages: |
any::gh
r-lib/lintr
any::purrr
needs: check

- name: Install package
run: R CMD INSTALL .
r-lib/lintr
local::.
- name: Extract and lint files changed by this PR
run: |
Expand All @@ -37,28 +37,8 @@ jobs:
changed_files <- purrr::map_chr(files, "filename")
all_files <- list.files(recursive = TRUE)
exclusions_list <- as.list(setdiff(all_files, changed_files))
lint_package(linters = all_linters(
absolute_path_linter = NULL,
assignment_linter = NULL,
commented_code_linter = NULL,
cyclocomp_linter(25L),
if_not_else_linter(exceptions = character(0L)),
implicit_integer_linter = NULL,
library_call_linter = NULL,
line_length_linter(120L),
namespace_linter = NULL,
nonportable_path_linter = NULL,
object_name_linter = NULL,
object_length_linter(50L),
object_usage_linter = NULL,
string_boundary_linter = NULL,
strings_as_factors_linter = NULL,
todo_comment_linter = NULL,
undesirable_function_linter = NULL,
undesirable_operator_linter = NULL,
unnecessary_concatenation_linter(allow_single_expression = FALSE),
unused_import_linter = NULL
), exclusions = exclusions_list)
# lintr config in `.lintr` file
lint_package(exclusions = exclusions_list)
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
26 changes: 2 additions & 24 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,12 @@ jobs:
local::.
needs: lint

# TODO: Revisit to remove some of these allowances after more important lints
# have been removed.
- name: Lint
run: |
options(crayon.enabled = TRUE)
library(lintr)
lint_package(linters = all_linters(
absolute_path_linter = NULL,
assignment_linter = NULL,
commented_code_linter = NULL,
cyclocomp_linter(25L),
if_not_else_linter(exceptions = character(0L)),
implicit_integer_linter = NULL,
library_call_linter = NULL,
line_length_linter(120L),
namespace_linter = NULL,
nonportable_path_linter = NULL,
object_name_linter = NULL,
object_length_linter(50L),
object_usage_linter = NULL,
string_boundary_linter = NULL,
strings_as_factors_linter = NULL,
todo_comment_linter = NULL,
undesirable_function_linter = NULL,
undesirable_operator_linter = NULL,
unnecessary_concatenation_linter(allow_single_expression = FALSE),
unused_import_linter = NULL
))
# lintr config in `.lintr` file
lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
3 changes: 1 addition & 2 deletions .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ linters: all_linters(
absolute_path_linter = NULL,
assignment_linter = NULL,
commented_code_linter = NULL,
cyclocomp_linter(25L),
cyclocomp_linter(20L),
if_not_else_linter(exceptions = character(0L)),
implicit_integer_linter = NULL,
library_call_linter = NULL,
Expand All @@ -12,7 +12,6 @@ linters: all_linters(
object_name_linter = NULL,
object_length_linter(50L),
object_usage_linter = NULL,
todo_comment_linter = NULL,
string_boundary_linter = NULL,
strings_as_factors_linter = NULL,
undesirable_function_linter = NULL,
Expand Down

0 comments on commit 5208f36

Please sign in to comment.