linters
Available linters
T_and_F_symbol_linter(source_file) assignment_linter(source_file) closed_curly_linter(allow_single_line = FALSE) commas_linter(source_file) commented_code_linter(source_file) todo_comment_linter(todo = c("todo", "fixme")) cyclocomp_linter(complexity_limit = 25) object_name_linter(styles = "snake_case") object_length_linter(length = 30L) camel_case_linter(source_file) equals_na_linter(source_file) extraction_operator_linter(source_file) function_left_parentheses_linter(source_file) implicit_integer_linter(source_file) infix_spaces_linter(source_file) line_length_linter(length) no_tab_linter(source_file) object_usage_linter(source_file) open_curly_linter(allow_single_line = FALSE) paren_brace_linter(source_file) absolute_path_linter(lax = TRUE) nonportable_path_linter(lax = TRUE) pipe_continuation_linter(source_file) semicolon_terminator_linter(semicolon = c("compound", "trailing")) seq_linter(source_file) single_quotes_linter(source_file) spaces_inside_linter(source_file) spaces_left_parentheses_linter(source_file) trailing_blank_lines_linter(source_file) trailing_whitespace_linter(source_file) undesirable_function_linter(fun = default_undesirable_functions) undesirable_operator_linter(op = default_undesirable_operators) unneeded_concatenation_linter(source_file)
source_file |
returned by |
allow_single_line |
if true allow a open and closed curly pair on the same line. |
todo |
Vector of strings that identify TODO comments. |
complexity_limit |
expressions with a cyclomatic complexity higher than
this are linted, defaults to 25. See |
styles |
A subset of ‘CamelCase’, ‘camelCase’, ‘snake_case’, ‘dotted.case’, ‘lowercase’, ‘UPPERCASE’. A name should match at least one of these styles. |
length |
the length cutoff to use for the given linter. |
lax |
Less stringent linting, leading to fewer false positives. |
semicolon |
A character vector defining which semicolons to report:
|
fun |
Named character vector, where the names are the names of the undesirable functions,
and the values are the text for the alternative function to use (or |
op |
Named character vector, where the names are the names of the undesirable operators,
and the values are the text for the alternative operator to use (or |
T_and_F_symbol_linter
: Avoid the symbols T
and F
(for TRUE
and FALSE
).
assignment_linter
: checks that '<-' is always used for assignment
closed_curly_linter
: check that closed curly braces should always be on their
own line unless they follow an else.
commas_linter
: check that all commas are followed by spaces, but do not
have spaces before them.
commented_code_linter
: Check that there is no commented code outside roxygen
blocks
todo_comment_linter
: Check that the source contains no TODO comments (case-insensitive).
cyclocomp_linter
: Check for overly complicated expressions. See
cyclocomp
.
object_name_linter
: Check that object names conform to a naming style.
object_length_linter
: check that object names are not too long.
camel_case_linter
: check that objects are not in camelCase.
equals_na_linter
: that checks for x == NA
extraction_operator_linter
: Check that the '[[' operator is used when extracting a single element from
an object, not '[' (subsetting) nor '$' (interactive use).
function_left_parentheses_linter
: check that all left parentheses in a function call
do not have spaces before them.
implicit_integer_linter
: Check that integers are explicitly typed using the form 1L
instead of
1
.
infix_spaces_linter
: check that all infix operators have spaces around them.
line_length_linter
: check the line length of both comments and code is less
than length.
no_tab_linter
: check that only spaces are used for indentation, not tabs.
object_usage_linter
: checks that closures have the proper usage using
checkUsage
. Note this runs
eval
on the code, so do not use with untrusted code.
open_curly_linter
: check that opening curly braces are never on their own
line and are always followed by a newline.
paren_brace_linter
: check that there is a space between right
parenthesis and an opening curly brace.
absolute_path_linter
: Check that no absolute paths are used (e.g. "/var", "C:\System", "~/docs").
nonportable_path_linter
: Check that file.path() is used to construct safe and portable paths.
pipe_continuation_linter
: Check that each step in a pipeline is on a new line, or
the entire pipe fits on one line.
semicolon_terminator_linter
: Check that no semicolons terminate statements.
seq_linter
: check for 1:length(...)
, 1:nrow(...)
,
1:ncol(...)
, 1:NROW(...)
and 1:NCOL(...)
expressions. These often cause bugs when the right hand side is zero.
It is safer to use seq_len
or
seq_along
instead.
single_quotes_linter
: checks that only single quotes are used to delimit
string constants.
spaces_inside_linter
: check that parentheses and square brackets do not have
spaces directly inside them.
spaces_left_parentheses_linter
: check that all left parentheses have a space before them
unless they are in a function call.
trailing_blank_lines_linter
: check there are no trailing blank lines.
trailing_whitespace_linter
: check there are no trailing whitespace characters.
undesirable_function_linter
: Report the use of undesirable functions, e.g. return
, options
,
or sapply
and suggest an alternative.
undesirable_operator_linter
: Report the use of undesirable operators, e.g. `:::`
or `<<-`
and suggest an alternative.
unneeded_concatenation_linter
: Check that the c
function is not used without arguments nor with a
single constant.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.