[ci][R-package] Minor refactoring for `lintr` code (#5327)

* Update utils.R

* Update lint_r_code.R

* Update lint_r_code.R

* Update lint_r_code.R

* Update lint_r_code.R
This commit is contained in:
Nikita Titov 2022-06-26 22:50:19 +03:00 коммит произвёл GitHub
Родитель e6310868ca
Коммит 24117b76a6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -34,7 +34,7 @@ LINTERS_TO_USE <- list(
, "any_is_na" = lintr::any_is_na_linter()
, "assignment" = lintr::assignment_linter()
, "braces" = lintr::brace_linter()
, "class_equals_linter" = lintr::class_equals_linter()
, "class_equals" = lintr::class_equals_linter()
, "commas" = lintr::commas_linter()
, "duplicate_argument" = lintr::duplicate_argument_linter()
, "equals_na" = lintr::equals_na_linter()
@ -63,8 +63,6 @@ LINTERS_TO_USE <- list(
, "trailing_blank" = lintr::trailing_blank_lines_linter()
, "trailing_white" = lintr::trailing_whitespace_linter()
, "true_false" = lintr::T_and_F_symbol_linter()
, "unreachable_code" = lintr::unreachable_code_linter()
, "vector_logic" = lintr::vector_logic_linter()
, "undesirable_function" = lintr::undesirable_function_linter(
fun = c(
"cat" = "CRAN forbids the use of cat() in packages except in special cases. Use message() or warning()."
@ -98,6 +96,8 @@ LINTERS_TO_USE <- list(
)
)
, "unneeded_concatenation" = lintr::unneeded_concatenation_linter()
, "unreachable_code" = lintr::unreachable_code_linter()
, "vector_logic" = lintr::vector_logic_linter()
)
noquote(paste0(length(FILES_TO_LINT), " R files need linting"))

Просмотреть файл

@ -1,13 +1,13 @@
lgb.is.Booster <- function(x) {
return(all(c("R6", "lgb.Booster") %in% class(x))) # nolint: class_equals_linter
return(all(c("R6", "lgb.Booster") %in% class(x))) # nolint: class_equals
}
lgb.is.Dataset <- function(x) {
return(all(c("R6", "lgb.Dataset") %in% class(x))) # nolint: class_equals_linter
return(all(c("R6", "lgb.Dataset") %in% class(x))) # nolint: class_equals
}
lgb.is.Predictor <- function(x) {
return(all(c("R6", "lgb.Predictor") %in% class(x))) # nolint: class_equals_linter
return(all(c("R6", "lgb.Predictor") %in% class(x))) # nolint: class_equals
}
lgb.is.null.handle <- function(x) {