-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement linter tags file compatible lintr 3.0.0 (#130)
- Loading branch information
1 parent
e5658e4
commit 293a178
Showing
4 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: box.linters | ||
Title: Linters for 'box' Modules | ||
Version: 0.10.1 | ||
Version: 0.10.1.9001 | ||
Authors@R: | ||
c( | ||
person("Ricardo Rodrigo", "Basa", role = c("aut", "cre"), email = "[email protected]"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
linter,tags | ||
box_alphabetical_calls_linter,best_practices readability | ||
box_func_import_count_linter,best_practices configurable readability configurable | ||
box_mod_fun_exists_linter,default executing | ||
box_pkg_fun_exists_linter,default executing | ||
box_separate_calls_linter,common_mistakes readibility | ||
box_trailing_commas_linter,common_mistakes best_practices configurable | ||
box_universal_import_linter,best_practices robustness efficiency | ||
box_unused_attached_mod_linter,default executing consistency efficiency | ||
box_unused_attached_mod_obj_linter,default executing consistency efficiency | ||
box_unused_attached_pkg_fun_linter,default executing consistency efficiency | ||
box_unused_attached_pkg_linter,default executing consistency efficiency | ||
box_usage_linter,default executing consistency | ||
namespace_function_calls,default correctness configurable | ||
r6_usage_linter,default executing consistency | ||
unused_declared_object_linter,default executing consistency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#' | ||
#' This file tests whether the lintr::available_linters() and lintr::available_tags() | ||
#' functions can read the csv file with linter definitions. | ||
#' | ||
#' lintr expects the package to be already installed. Those tests need to be run | ||
#' using devtools::check(), otherwise will be skipped. | ||
#' | ||
#' Manual checks can also be performed by installing the package and setting the | ||
#' `linters_csv_location` variable to "./inst/lintr/linters.csv", then running | ||
#' tests in the console. | ||
#' | ||
linters_csv_location <- "../../box.linters/lintr/linters.csv" | ||
|
||
test_that("lintr::available_linters() reads csv file with linters and tags", { | ||
skip_if(!file.exists(linters_csv_location)) | ||
|
||
expected_linters <- read.csv(linters_csv_location) | ||
detected_linters <- lintr::available_linters("box.linters") | ||
|
||
expect_identical(detected_linters$linter, expected_linters$linter) | ||
expect_identical(detected_linters$tags, strsplit(expected_linters$tags, " ")) | ||
}) | ||
|
||
test_that("lintr::available_tags() reads list of tags for the package", { | ||
skip_if(!file.exists(linters_csv_location)) | ||
|
||
expected_tags <- read.csv(linters_csv_location)$tags |> | ||
strsplit(" ") |> | ||
unlist() |> | ||
unique() |> | ||
sort() | ||
|
||
detected_tags <- lintr::available_tags("box.linters") | ||
|
||
expect_identical(detected_tags, expected_tags) | ||
}) |