Skip to content

Commit

Permalink
[ci] [R-package] upgrade to lintr v3.0 (fixes #5228)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Jun 16, 2022
1 parent f96c4ce commit 7348f6f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
44 changes: 21 additions & 23 deletions .ci/lint_r_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,35 @@ interactive_text <- paste0(
)

LINTERS_TO_USE <- list(
"absolute_path" = lintr::absolute_path_linter
, "assignment" = lintr::assignment_linter
, "closed_curly" = lintr::closed_curly_linter
, "commas" = lintr::commas_linter
, "equals_na" = lintr::equals_na_linter
, "function_left" = lintr::function_left_parentheses_linter
, "implicit_integers" = lintr::implicit_integer_linter
, "infix_spaces" = lintr::infix_spaces_linter
"absolute_path" = lintr::absolute_path_linter()
, "assignment" = lintr::assignment_linter()
, "braces" = lintr::brace_linter()
, "commas" = lintr::commas_linter()
, "equals_na" = lintr::equals_na_linter()
, "function_left" = lintr::function_left_parentheses_linter()
, "implicit_integers" = lintr::implicit_integer_linter()
, "infix_spaces" = lintr::infix_spaces_linter()
, "long_lines" = lintr::line_length_linter(length = 120L)
, "no_tabs" = lintr::no_tab_linter
, "non_portable_path" = lintr::nonportable_path_linter
, "open_curly" = lintr::open_curly_linter
, "paren_brace_linter" = lintr::paren_brace_linter
, "semicolon" = lintr::semicolon_terminator_linter
, "seq" = lintr::seq_linter
, "single_quotes" = lintr::single_quotes_linter
, "spaces_inside" = lintr::spaces_inside_linter
, "spaces_left_parens" = lintr::spaces_left_parentheses_linter
, "no_tabs" = lintr::no_tab_linter()
, "non_portable_path" = lintr::nonportable_path_linter()
, "semicolon" = lintr::semicolon_linter()
, "seq" = lintr::seq_linter()
, "single_quotes" = lintr::single_quotes_linter()
, "spaces_inside" = lintr::spaces_inside_linter()
, "spaces_left_parens" = lintr::spaces_left_parentheses_linter()
, "todo_comments" = lintr::todo_comment_linter(c("todo", "fixme", "to-do"))
, "trailing_blank" = lintr::trailing_blank_lines_linter
, "trailing_white" = lintr::trailing_whitespace_linter
, "true_false" = lintr::T_and_F_symbol_linter
, "trailing_blank" = lintr::trailing_blank_lines_linter()
, "trailing_white" = lintr::trailing_whitespace_linter()
, "true_false" = lintr::T_and_F_symbol_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()."
, "cbind" = paste0(
"cbind is an unsafe way to build up a data frame. merge() or direct "
, "column assignment is preferred."
)
, "dyn.load" = "Directly loading/unloading .dll/.so files in package code should not be necessary."
, "dyn.unload" = "Directly loading/unloading .dll/.so files in package code should not be necessary."
, "dyn.load" = "Directly loading or unloading .dll or .so files in package code should not be necessary."
, "dyn.unload" = "Directly loading or unloading .dll or .so files in package code should not be necessary."
, "help" = interactive_text
, "ifelse" = "The use of ifelse() is dangerous because it will silently allow mixing types."
, "install.packages" = interactive_text
Expand All @@ -83,7 +81,7 @@ LINTERS_TO_USE <- list(
, "??" = interactive_text
)
)
, "unneeded_concatenation" = lintr::unneeded_concatenation_linter
, "unneeded_concatenation" = lintr::unneeded_concatenation_linter()
)

noquote(paste0(length(FILES_TO_LINT), " R files need linting"))
Expand Down
2 changes: 1 addition & 1 deletion .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if [[ $TASK == "lint" ]]; then
mypy \
pycodestyle \
pydocstyle \
"r-lintr>=2.0,<3.0"
"r-lintr>=3.0"
echo "Linting Python code"
pycodestyle --ignore=E501,W503 --exclude=./.nuget,./external_libs . || exit -1
pydocstyle --convention=numpy --add-ignore=D105 --match-dir="^(?!^external_libs|test|example).*" --match="(?!^test_|setup).*\.py" . || exit -1
Expand Down
2 changes: 1 addition & 1 deletion build_r.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TEMP_SOURCE_DIR <- file.path(TEMP_R_DIR, "src")
, "make_args" = character(0L)
)
for (arg in args) {
if (any(grepl("^\\-j[0-9]+", arg))) {
if (any(grepl("^\\-j[0-9]+", arg))) { # nolint: non_portable_path
out_list[["make_args"]] <- arg
} else if (any(grepl("=", arg))) {
split_arg <- strsplit(arg, "=")[[1L]]
Expand Down

0 comments on commit 7348f6f

Please sign in to comment.