From dfb32b950254cfa6286c556b22d81e86f08182a7 Mon Sep 17 00:00:00 2001 From: RasmusSkytte Date: Fri, 20 Mar 2026 13:56:58 +0000 Subject: [PATCH 1/3] chore: synced file(s) with ssi-dk/AEF-DDF --- .github/sync_reverse.yaml | 2 + tests/testthat/test-0_linters.R | 78 +++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/testthat/test-0_linters.R diff --git a/.github/sync_reverse.yaml b/.github/sync_reverse.yaml index 1c35f380..4dedf14f 100644 --- a/.github/sync_reverse.yaml +++ b/.github/sync_reverse.yaml @@ -11,3 +11,5 @@ ssi-dk/AEF-DDF: dest: linting/.lintr - source: R/0_linters.R dest: linting/0_linters.R + - source: tests/testthat/test-0_linters.R + dest: linting/test-0_linters.R diff --git a/tests/testthat/test-0_linters.R b/tests/testthat/test-0_linters.R new file mode 100644 index 00000000..7a6b64b9 --- /dev/null +++ b/tests/testthat/test-0_linters.R @@ -0,0 +1,78 @@ +test_that("nolint_position_linter works", { # nolint start: nolint_position_linter + skip_if_not_installed("lintr") + + lintr::expect_lint( + paste0(strrep("x", 5), "# nolint: object_name_linter."), + list("column_number" = 6, "type" = "style"), + c(nolint_position_linter(length = 20L), lintr::object_name_linter()) + ) + + lintr::expect_lint( + paste0(strrep("x", 20), "# nolint: object_name_linter."), + NULL, + c(nolint_position_linter(length = 20L), lintr::object_name_linter()) + ) +}) # nolint end + + +test_that("nolint_line_length_linter works", { # nolint start: nolint_position_linter + skip_if_not_installed("lintr") + + lintr::expect_lint( + paste0(strrep("x", 5), "# nolint: object_name_linter."), + list("column_number" = 5, "type" = "style"), + c(nolint_line_length_linter(length = 4L), lintr::object_name_linter()) + ) + + lintr::expect_lint( + paste0(strrep("x", 5), "# nolint: object_name_linter."), + NULL, + c(nolint_line_length_linter(length = 5L), lintr::object_name_linter()) + ) +}) # nolint end + + +test_that("non_ascii_linter works", { + skip_if_not_installed("lintr") + + lintr::expect_lint("æ", list("line_number" = 1, "type" = "style"), non_ascii_linter()) # nolint start: non_ascii_linter + lintr::expect_lint("\nø", list("line_number" = 2, "type" = "style"), non_ascii_linter()) + lintr::expect_lint("\n\nå", list("line_number" = 3, "type" = "style"), non_ascii_linter()) + lintr::expect_lint("æ", list("line_number" = 1, "type" = "style"), non_ascii_linter()) # nolint end + + lintr::expect_lint("xxx", NULL, non_ascii_linter()) + lintr::expect_lint("abc", NULL, non_ascii_linter()) +}) + + +test_that("param_and_field_linter works", { + skip_if_not_installed("lintr") + + lintr::expect_lint("#' @param test (type)\\cr", list("line_number" = 1, "type" = "style"), param_and_field_linter()) # nolint start: param_and_field_linter + lintr::expect_lint("#' @field test (type)\\cr", list("line_number" = 1, "type" = "style"), param_and_field_linter()) + lintr::expect_lint("#' @param test (`type`)", list("line_number" = 1, "type" = "style"), param_and_field_linter()) + lintr::expect_lint("#' @field test (`type`)", list("line_number" = 1, "type" = "style"), param_and_field_linter()) # nolint end + + lintr::expect_lint("#' @param test (`type`)\\cr", NULL, param_and_field_linter()) + lintr::expect_lint("#' @field test (`type`)\\cr", NULL, param_and_field_linter()) +}) + + +test_that("documentation_template_linter works", { + skip_if_not_installed("lintr") + skip_if_not_installed("devtools") + skip_if(!interactive(), "Skip if running in R_check") + skip_on_cran() + + lintr::expect_lint( + "#' @param observable text", # rd_observable defined in R/0_documentation.R # nolint: documentation_template_linter, param_and_field_linter + list("line_number" = 1, "type" = "style"), + documentation_template_linter() + ) + + lintr::expect_lint( + "#' @param observable `r rd_test`", + NULL, + documentation_template_linter() + ) +}) From 70bf17acdd8ef946a5c6b067819c504f203a3bb6 Mon Sep 17 00:00:00 2001 From: RasmusSkytte Date: Sat, 21 Mar 2026 00:58:25 +1100 Subject: [PATCH 2/3] chore: Update pak.lock --- pak.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pak.lock b/pak.lock index aa14a07b..0290f027 100644 --- a/pak.lock +++ b/pak.lock @@ -1,7 +1,7 @@ { "lockfile_version": 1, - "os": "Ubuntu 24.04.4 LTS", - "r_version": "R version 4.5.3 (2026-03-11)", + "os": "Ubuntu 24.04.3 LTS", + "r_version": "R version 4.5.2 (2025-10-31)", "platform": "x86_64-pc-linux-gnu", "packages": [ { From 31a4dde543883c03aff961217e2a7e1981253547 Mon Sep 17 00:00:00 2001 From: RasmusSkytte Date: Sat, 21 Mar 2026 01:03:07 +1100 Subject: [PATCH 3/3] chore: Update pak.lock --- pak.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pak.lock b/pak.lock index 0290f027..aa14a07b 100644 --- a/pak.lock +++ b/pak.lock @@ -1,7 +1,7 @@ { "lockfile_version": 1, - "os": "Ubuntu 24.04.3 LTS", - "r_version": "R version 4.5.2 (2025-10-31)", + "os": "Ubuntu 24.04.4 LTS", + "r_version": "R version 4.5.3 (2026-03-11)", "platform": "x86_64-pc-linux-gnu", "packages": [ {