Skip to content

Commit ff5457b

Browse files
Use lintr config file also in GHA (#954)
* Use lintr config file also in GHA * fix lints
1 parent a94dadc commit ff5457b

File tree

8 files changed

+9
-80
lines changed

8 files changed

+9
-80
lines changed

.github/workflows/lint-changed-files.yaml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ jobs:
2121
- uses: r-lib/actions/setup-r-dependencies@v2
2222
with:
2323
pak-version: devel
24-
upgrade: "TRUE"
24+
upgrade: 'TRUE'
25+
needs: check
2526
extra-packages: |
2627
any::gh
2728
any::purrr
2829
r-lib/lintr
29-
needs: check
30-
31-
- name: Install package
32-
run: R CMD INSTALL .
30+
local::.
3331
3432
- name: Extract and lint files changed by this PR
3533
run: |
@@ -39,28 +37,8 @@ jobs:
3937
changed_files <- purrr::map_chr(files, "filename")
4038
all_files <- list.files(recursive = TRUE)
4139
exclusions_list <- as.list(setdiff(all_files, changed_files))
42-
lint_package(linters = all_linters(
43-
absolute_path_linter = NULL,
44-
assignment_linter = NULL,
45-
commented_code_linter = NULL,
46-
cyclocomp_linter(25L),
47-
if_not_else_linter(exceptions = character(0L)),
48-
implicit_integer_linter = NULL,
49-
library_call_linter = NULL,
50-
line_length_linter(120L),
51-
namespace_linter = NULL,
52-
nonportable_path_linter = NULL,
53-
object_name_linter = NULL,
54-
object_length_linter(50L),
55-
object_usage_linter = NULL,
56-
string_boundary_linter = NULL,
57-
strings_as_factors_linter = NULL,
58-
todo_comment_linter = NULL,
59-
undesirable_function_linter = NULL,
60-
undesirable_operator_linter = NULL,
61-
unnecessary_concatenation_linter(allow_single_expression = FALSE),
62-
unused_import_linter = NULL
63-
), exclusions = exclusions_list)
40+
# lintr config in `.lintr` file
41+
lint_package(exclusions = exclusions_list)
6442
shell: Rscript {0}
6543
env:
6644
LINTR_ERROR_ON_LINT: true

.github/workflows/lint.yaml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,12 @@ jobs:
3333
local::.
3434
needs: lint
3535

36-
# TODO: Revisit to remove some of these allowances after more important lints
37-
# have been removed.
3836
- name: Lint
3937
run: |
4038
options(crayon.enabled = TRUE)
4139
library(lintr)
42-
lint_package(linters = all_linters(
43-
absolute_path_linter = NULL,
44-
assignment_linter = NULL,
45-
commented_code_linter = NULL,
46-
cyclocomp_linter(25L),
47-
if_not_else_linter(exceptions = character(0L)),
48-
implicit_integer_linter = NULL,
49-
library_call_linter = NULL,
50-
line_length_linter(120L),
51-
namespace_linter = NULL,
52-
nonportable_path_linter = NULL,
53-
object_name_linter = NULL,
54-
object_length_linter(50L),
55-
object_usage_linter = NULL,
56-
string_boundary_linter = NULL,
57-
strings_as_factors_linter = NULL,
58-
todo_comment_linter = NULL,
59-
undesirable_function_linter = NULL,
60-
undesirable_operator_linter = NULL,
61-
unnecessary_concatenation_linter(allow_single_expression = FALSE),
62-
unused_import_linter = NULL
63-
))
40+
# lintr config in `.lintr` file
41+
lint_package()
6442
shell: Rscript {0}
6543
env:
6644
LINTR_ERROR_ON_LINT: true

.lintr

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ linters: all_linters(
1212
object_name_linter = NULL,
1313
object_length_linter(50L),
1414
object_usage_linter = NULL,
15-
todo_comment_linter = NULL,
1615
string_boundary_linter = NULL,
17-
strings_as_factors_linter = NULL,
16+
strings_as_factors_linter = NULL, # since R > 4.0
1817
undesirable_function_linter = NULL,
19-
undesirable_operator_linter = NULL,
2018
unnecessary_concatenation_linter(allow_single_expression = FALSE),
2119
unused_import_linter = NULL
2220
)

R/ggpiestats.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ggpiestats <- function(
114114
x_levels <- nlevels(pull(data, {{ x }}))
115115
y_levels <- ifelse(test == "one.way", 0L, nlevels(pull(data, {{ y }})))
116116

117-
# TODO: one-way table in `BayesFactor` (richarddmorey/BayesFactor#159)
117+
# one-way table not supported in `BayesFactor` ATM (richarddmorey/BayesFactor#159)
118118
if (test == "two.way" && y_levels == 1L) bf.message <- FALSE
119119

120120
# faceting is possible only if both vars have more than one level

tests/testthat/test-ggbarstats.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ test_that(
162162
# dropped level dataset
163163
mtcars_small <- dplyr::filter(mtcars, am == "0")
164164

165-
# TODO: should one-way table results be shown in the subtitle?
166165
set.seed(123)
167166
expect_doppelganger(
168167
title = "works with dropped levels",

tests/testthat/test-gghistostats.R

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,6 @@ test_that(
8686
}
8787
)
8888

89-
# utilities ---------------
90-
91-
test_that(
92-
".binwidth works as expected",
93-
{
94-
expect_equal(ggstatsplot:::.binwidth(mtcars$wt), 0.6913737, tolerance = 0.001)
95-
}
96-
)
97-
9889
# grouped_gghistostats works ---------------------------------------------
9990

10091
test_that(

tests/testthat/test-ggpiestats.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ test_that(
148148
# dropped level dataset
149149
mtcars_small <- dplyr::filter(mtcars, am == "0")
150150

151-
# TODO: should one-way table results be shown in the subtitle?
152151
set.seed(123)
153152
expect_doppelganger(
154153
title = "works with dropped levels",

tests/testthat/test-ggscatterstats.R

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,6 @@ test_that("labeling variables and expressions work as expected", {
7575
results.subtitle = FALSE
7676
)
7777
)
78-
79-
# TODO: generate snapshot on Windows machine
80-
# set.seed(123)
81-
# expect_doppelganger(
82-
# title = "label variable but no expression",
83-
# fig = ggscatterstats(
84-
# data = df,
85-
# x = sleep_total,
86-
# y = sleep_cycle,
87-
# label.expression = NULL,
88-
# label.var = order,
89-
# results.subtitle = FALSE
90-
# )
91-
# )
9278
})
9379

9480
# subtitle output ----------------------------------------------------------

0 commit comments

Comments
 (0)