Skip to content

Commit 5dbb01d

Browse files
committed
build: update R lint configuration
1 parent 7efd89c commit 5dbb01d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

tools/lint/r/linter.R

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
# [1]: https://github.com/jimhester/lintr
2626

2727
# Ensure that the `lintr` package is installed...
28-
if ( !require( "lintr", quietly = TRUE, character.only = TRUE ) ) {
29-
install.packages( "lintr", repos = "http://lib.stat.cmu.edu/R/CRAN/", quiet = TRUE );
28+
if ( !require( 'lintr', quietly = TRUE, character.only = TRUE ) ) {
29+
install.packages( 'lintr', repos = 'http://lib.stat.cmu.edu/R/CRAN/', quiet = TRUE );
3030
}
3131

3232
# Get only the trailing command-line arguments:
3333
args <- commandArgs( trailingOnly = TRUE );
3434

3535
# Check that at least one filepath has been provided...
3636
n <- length( args );
37-
if ( n == 0 ) {
38-
stop( "Must provide at least one file to lint.", call. = FALSE );
37+
if ( n == 0L ) {
38+
stop( 'Must provide at least one file to lint.', call. = FALSE );
3939
}
4040

4141
# Specify which linters to use...
@@ -65,7 +65,8 @@ linters <- lintr::linters_with_defaults( defaults = default_linters,
6565
line_length_linter = lintr::line_length_linter( 200L ),
6666

6767
# Allow tabs:
68-
no_tab_linter = NULL, # lintr::no_tab_linter(),
68+
indentation_linter = NULL, # lintr::indentation_linter(),
69+
whitespace_linter = NULL, # lintr::whitespace_linter(),
6970

7071
# Require that `file.path()` is used to construct safe and portable paths:
7172
nonportable_path_linter = lintr::nonportable_path_linter(),
@@ -74,7 +75,7 @@ linters <- lintr::linters_with_defaults( defaults = default_linters,
7475
object_length_linter = lintr::object_length_linter( 30L ),
7576

7677
# Require that object names conform to a single naming style (e.g., snake_case or lowerCamelCase):
77-
object_name_linter = lintr::object_name_linter( "snake_case"),
78+
object_name_linter = lintr::object_name_linter( 'snake_case' ),
7879

7980
# Require that closures have the proper usage using `checkUsage`:
8081
object_usage_linter = lintr::object_usage_linter(),
@@ -89,7 +90,7 @@ linters <- lintr::linters_with_defaults( defaults = default_linters,
8990
semicolon_linter = lintr::semicolon_linter( allow_trailing = TRUE ),
9091

9192
# Require that only single quotes be used to delimit strings:
92-
single_quotes_linter = lintr::single_quotes_linter(),
93+
quotes_linter = lintr::quotes_linter(delimiter = "'"),
9394

9495
# Allow spaces directly inside parentheses and square brackets:
9596
spaces_inside_linter = NULL, # lintr::spaces_inside_linter(),
@@ -116,15 +117,15 @@ linters <- lintr::linters_with_defaults( defaults = default_linters,
116117
undesirable_operator_linter = lintr::undesirable_operator_linter(),
117118

118119
# Ensure that the `c` function is not used without arguments or with a single constant:
119-
unneeded_concatenation_linter = lintr::unneeded_concatenation_linter()
120+
unnecessary_concatenation_linter = lintr::unnecessary_concatenation_linter()
120121
);
121122

122123
# Lint each file...
123-
status <- 0;
124-
for ( i in 1:n ) {
124+
status <- 0L;
125+
for ( i in 1L:n ) {
125126
results <- lintr::lint( args[ i ], linters = linters );
126-
if ( length( results ) > 0 ) {
127-
status <- 1;
127+
if ( length( results ) > 0L ) {
128+
status <- 1L;
128129
print( results );
129130
}
130131
}

0 commit comments

Comments
 (0)