From 96ca194c2519575c55f9abd83a0194138fdbf248 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Fri, 6 Sep 2024 21:48:23 +0200 Subject: [PATCH 1/3] Test to check that all linters are covered by tags --- tests/testthat/test-linter_tags.R | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/testthat/test-linter_tags.R b/tests/testthat/test-linter_tags.R index 2d7f53810..a3487e2a5 100644 --- a/tests/testthat/test-linter_tags.R +++ b/tests/testthat/test-linter_tags.R @@ -234,3 +234,11 @@ test_that("available_linters gives precedence to included tags", { available_linters(tags = "deprecated", exclude_tags = NULL) ) }) + +test_that("all non-deprecated linters are covered across tags", { + tags <- setdiff(available_tags(), "deprecated") + tagged_linters <- lapply(tags, function(tag) names(linters_with_tags(tag))) # nolint: undesirable_function_linter. + tagged_linters <- unique(unlist(tagged_linters)) + all_linters <- names(all_linters()) + expect_identical(sort(tagged_linters), sort(all_linters)) +}) From 9ff8e37dd506f1eb7687dded6893d2a6dd87af42 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 7 Sep 2024 08:52:05 +0200 Subject: [PATCH 2/3] simplify test as suggested in review --- tests/testthat/test-linter_tags.R | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/testthat/test-linter_tags.R b/tests/testthat/test-linter_tags.R index a3487e2a5..01a4bdb55 100644 --- a/tests/testthat/test-linter_tags.R +++ b/tests/testthat/test-linter_tags.R @@ -236,9 +236,5 @@ test_that("available_linters gives precedence to included tags", { }) test_that("all non-deprecated linters are covered across tags", { - tags <- setdiff(available_tags(), "deprecated") - tagged_linters <- lapply(tags, function(tag) names(linters_with_tags(tag))) # nolint: undesirable_function_linter. - tagged_linters <- unique(unlist(tagged_linters)) - all_linters <- names(all_linters()) - expect_identical(sort(tagged_linters), sort(all_linters)) + expect_true(all(lengths(available_linters()$tags) > 0L)) }) From 03986c24a4f17754c9c088d80a8a3daa3729c965 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 7 Sep 2024 08:53:00 +0200 Subject: [PATCH 3/3] rename test --- tests/testthat/test-linter_tags.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-linter_tags.R b/tests/testthat/test-linter_tags.R index 01a4bdb55..92ee49f80 100644 --- a/tests/testthat/test-linter_tags.R +++ b/tests/testthat/test-linter_tags.R @@ -235,6 +235,6 @@ test_that("available_linters gives precedence to included tags", { ) }) -test_that("all non-deprecated linters are covered across tags", { +test_that("all linters have at least one tag", { expect_true(all(lengths(available_linters()$tags) > 0L)) })