Unverified Commit 688f73d1 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[ci] [R-package] upgrade to lintr v3.0 (fixes #5228) (#5294)

parent f96c4ceb
...@@ -29,28 +29,26 @@ interactive_text <- paste0( ...@@ -29,28 +29,26 @@ interactive_text <- paste0(
) )
LINTERS_TO_USE <- list( LINTERS_TO_USE <- list(
"absolute_path" = lintr::absolute_path_linter "absolute_path" = lintr::absolute_path_linter()
, "assignment" = lintr::assignment_linter , "assignment" = lintr::assignment_linter()
, "closed_curly" = lintr::closed_curly_linter , "braces" = lintr::brace_linter()
, "commas" = lintr::commas_linter , "commas" = lintr::commas_linter()
, "equals_na" = lintr::equals_na_linter , "equals_na" = lintr::equals_na_linter()
, "function_left" = lintr::function_left_parentheses_linter , "function_left" = lintr::function_left_parentheses_linter()
, "implicit_integers" = lintr::implicit_integer_linter , "implicit_integers" = lintr::implicit_integer_linter()
, "infix_spaces" = lintr::infix_spaces_linter , "infix_spaces" = lintr::infix_spaces_linter()
, "long_lines" = lintr::line_length_linter(length = 120L) , "long_lines" = lintr::line_length_linter(length = 120L)
, "no_tabs" = lintr::no_tab_linter , "no_tabs" = lintr::no_tab_linter()
, "non_portable_path" = lintr::nonportable_path_linter , "non_portable_path" = lintr::nonportable_path_linter()
, "open_curly" = lintr::open_curly_linter , "semicolon" = lintr::semicolon_linter()
, "paren_brace_linter" = lintr::paren_brace_linter , "seq" = lintr::seq_linter()
, "semicolon" = lintr::semicolon_terminator_linter , "single_quotes" = lintr::single_quotes_linter()
, "seq" = lintr::seq_linter , "spaces_inside" = lintr::spaces_inside_linter()
, "single_quotes" = lintr::single_quotes_linter , "spaces_left_parens" = lintr::spaces_left_parentheses_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")) , "todo_comments" = lintr::todo_comment_linter(c("todo", "fixme", "to-do"))
, "trailing_blank" = lintr::trailing_blank_lines_linter , "trailing_blank" = lintr::trailing_blank_lines_linter()
, "trailing_white" = lintr::trailing_whitespace_linter , "trailing_white" = lintr::trailing_whitespace_linter()
, "true_false" = lintr::T_and_F_symbol_linter , "true_false" = lintr::T_and_F_symbol_linter()
, "undesirable_function" = lintr::undesirable_function_linter( , "undesirable_function" = lintr::undesirable_function_linter(
fun = c( fun = c(
"cat" = "CRAN forbids the use of cat() in packages except in special cases. Use message() or warning()." "cat" = "CRAN forbids the use of cat() in packages except in special cases. Use message() or warning()."
...@@ -58,8 +56,8 @@ LINTERS_TO_USE <- list( ...@@ -58,8 +56,8 @@ LINTERS_TO_USE <- list(
"cbind is an unsafe way to build up a data frame. merge() or direct " "cbind is an unsafe way to build up a data frame. merge() or direct "
, "column assignment is preferred." , "column assignment is preferred."
) )
, "dyn.load" = "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/unloading .dll/.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 , "help" = interactive_text
, "ifelse" = "The use of ifelse() is dangerous because it will silently allow mixing types." , "ifelse" = "The use of ifelse() is dangerous because it will silently allow mixing types."
, "install.packages" = interactive_text , "install.packages" = interactive_text
...@@ -83,7 +81,7 @@ LINTERS_TO_USE <- list( ...@@ -83,7 +81,7 @@ LINTERS_TO_USE <- list(
, "??" = interactive_text , "??" = interactive_text
) )
) )
, "unneeded_concatenation" = lintr::unneeded_concatenation_linter , "unneeded_concatenation" = lintr::unneeded_concatenation_linter()
) )
noquote(paste0(length(FILES_TO_LINT), " R files need linting")) noquote(paste0(length(FILES_TO_LINT), " R files need linting"))
......
...@@ -75,7 +75,7 @@ if [[ $TASK == "lint" ]]; then ...@@ -75,7 +75,7 @@ if [[ $TASK == "lint" ]]; then
mypy \ mypy \
pycodestyle \ pycodestyle \
pydocstyle \ pydocstyle \
"r-lintr>=2.0,<3.0" "r-lintr>=3.0"
echo "Linting Python code" echo "Linting Python code"
pycodestyle --ignore=E501,W503 --exclude=./.nuget,./external_libs . || exit -1 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 pydocstyle --convention=numpy --add-ignore=D105 --match-dir="^(?!^external_libs|test|example).*" --match="(?!^test_|setup).*\.py" . || exit -1
......
...@@ -24,7 +24,7 @@ TEMP_SOURCE_DIR <- file.path(TEMP_R_DIR, "src") ...@@ -24,7 +24,7 @@ TEMP_SOURCE_DIR <- file.path(TEMP_R_DIR, "src")
, "make_args" = character(0L) , "make_args" = character(0L)
) )
for (arg in args) { 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 out_list[["make_args"]] <- arg
} else if (any(grepl("=", arg))) { } else if (any(grepl("=", arg))) {
split_arg <- strsplit(arg, "=")[[1L]] split_arg <- strsplit(arg, "=")[[1L]]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment