Configurable linters
Deprecated linters
Exclude lines or files from linting
Consistency linters
Equality check with NA linter
Cyclomatic complexity linter
Efficiency linters
Correctness linters
Block assignment of {}
Default linters
Require usage of expect_identical(x, y)
where appropriate
Force &&
conditions to be written separately where appropriate
duplicate_argument_linter
Duplicate argument linter
consecutive_assertion_linter
Force consecutive calls to assertions into just one when possible
Code executing linters
Require usage of expect_length(x, n)
over expect_equal(length(x), n)
Require usage of expect_gt(x, y)
over expect_true(x > y)
(and similar)
Require usage of expect_named(x, n)
over expect_equal(names(x), n)
Require usage of expect_false(x)
over expect_true(!x)
extraction_operator_linter
Extraction operator linter
Require usage of expect_type(x, type)
over expect_equal(typeof(x), type)
Require usage of expect_s4_class(x, k)
over expect_true(is(x, k))
Function argument linter
function_left_parentheses_linter
Function left parentheses linter
Require usage of expect_s3_class()
Require usage of expect_null
for checking NULL
implicit_assignment_linter
Avoid implicit assignment in function calls
Require usage of nlevels over length(levels(.))
Check that indentation is consistent
Implicit integer linter
Require usage of expect_true(x)
over expect_equal(x, TRUE)
Parsed sourced file from a filename
Test that the package is lint free
Lint expectation
Require c()
to be applied before relatively expensive vectorized functions
Is this an expression- or a file-level source object?
all_undesirable_functions
Default undesirable functions and operators
Default lintr settings
Redirect is.numeric(x) || is.integer(x)
to just use is.numeric(x)
Lint common mistakes/style issues cropping up from return statements
Extract text from STR_CONST
nodes
Get parsed IDs by token
Require usage of fixed=TRUE
in regular expressions where appropriate
Require usage of correctly-typed literals over literal coercions
Create a linter from an XPath
Lint a file, directory, or package
Available linters
Block statements like if (!A) x else y
Block usage of ifelse()
where pmin()
or pmax()
is more appropriate
Block usage of for loops directly overwriting the indexing variable
Require usage of lengths()
where possible
Lintr
Library call linter
Create a tag-based linter configuration
Block usage of nested ifelse()
calls
Object length linter
Block unnecessary quoting in calls
numeric_leading_zero_linter
Require usage of a leading zero in all fractional numerics
Infix spaces linter
Require usage of !any(x)
over all(!x)
, !all(x)
over any(!x)
Pipe call linter
Create a linter configuration based on defaults
Namespace linter
package_development_linters
Package development linters
Deprecated functions in lintr
Missing package linter
Modify lintr defaults
Check for a common mistake where length is applied in the wrong place
read a source file and parse all the excluded lines from it
Object usage linter
Create a lint
object
Object name linter
Prevent ifelse()
from being used to produce TRUE
/FALSE
or 1
/0
Non-portable path linter
Line length linter
Normalize lint exclusions
routine_registration_linter
Identify unregistered native routines
SARIF Report for lint results
Repeat linter
Parenthesis before body linter
Package hooks linter
strings_as_factors_linter
Identify cases where stringsAsFactors
should be supplied explicitly
Robustness linters
Require usage of direct methods for subsetting strings via regex
Sequence linter
undesirable_function_linter
Undesirable function linter
undesirable_operator_linter
Undesirable operator linter
Raise lints for several common poor usages of paste()
Readability linters
Check for common mistakes around sorting vectors
trailing_blank_lines_linter
Trailing blank lines linter
Pipe continuation linter
Require correct sprintf()
calls
Pipe consistency linter
Testthat linters
Require usage of startsWith()
and endsWith()
over grepl()
/substr()
versions
Block usage of file.path()
with system.file()
Block unreachable code and comments following return statements
trailing_whitespace_linter
Trailing whitespace linter
Check that imported packages are actually used
Character string quote linter
Require usage of colSums(x)
or rowSums(x)
over apply(x, ., sum)
unnecessary_concatenation_linter
Unneeded concatenation linter
Block usage like x %in% "a"
unnecessary_lambda_linter
Block usage of anonymous functions in iteration functions when unnecessary
Read lintr settings
Missing argument linter
Whitespace linter
Semicolon linter
Block usage of ==
, !=
on logical vectors
Spaces inside linter
TODO comment linter
unnecessary_nested_if_linter
Avoid unnecessary nested if
conditional statements
unnecessary_placeholder_linter
Block usage of pipeline placeholders if unnecessary
Use lintr in your project
Style linters
spaces_left_parentheses_linter
Spaces before parentheses linter
Enforce usage of scalar logical operators in conditional statements
Convert an XML node or nodeset into a Lint
Block obvious "yoda tests"
Get the name of the function matched by an XPath
Get Linter metadata from a package
T
and F
symbol linter
Create a linter
closure
Assignment linter
Best practices linters
Require usage of anyDuplicated(x) > 0
over any(duplicated(x))
Backport linter
Absolute path linter
Create a linter configuration based on all available linters
Require usage of anyNA(x)
over any(is.na(x))
Commented code linter
Clear the lintr cache
Brace linter
Checkstyle Report for lint results
Commas linter
boolean_arithmetic_linter
Require usage of boolean operators over equivalent arithmetic
Block usage of paste()
and paste0()
with messaging functions using ...
Block comparison of class with ==
Common mistake linters