Skip to contents

Find and fix lints

fix() fix_dir() fix_package() fix_text()
Automatically replace lints
lint() lint_dir() lint_package() lint_text()
List all lints in a file or a directory
list_linters()
Get the list of linters in flint

Setup flint

setup_flint()
Setup flint
setup_flint_gha()
Create a Github Actions workflow for flint
update_flint()
Update the flint setup

Linters

T_and_F_symbol_linter
T and F symbol linter
any_duplicated_linter
Require usage of anyDuplicated(x) > 0 over any(duplicated(x))
any_is_na_linter
Require usage of anyNA(x) over any(is.na(x))
class_equals_linter
Block comparison of class with ==
double_assignment_linter
double_assignment
duplicate_argument_linter
Duplicate argument linter
empty_assignment_linter
empty_assignment
equal_assignment_linter
equal_assignment
equals_na_linter
Equality check with NA linter
expect_comparison_linter
Require usage of expect_gt(x, y) over expect_true(x > y) (and similar)
expect_identical_linter
Require usage of expect_identical(x, y) where appropriate
expect_length_linter
Require usage of expect_length(x, n) over expect_equal(length(x), n)
expect_named_linter
Require usage of expect_named(x, n) over expect_equal(names(x), n)
expect_not_linter
Require usage of expect_false(x) over expect_true(!x)
expect_null_linter
Require usage of expect_null for checking NULL
expect_true_false_linter
Require usage of expect_true(x) over expect_equal(x, TRUE)
expect_type_linter
Require usage of expect_type(x, type) over expect_equal(typeof(x), type)
for_loop_index_linter
Block usage of for loops directly overwriting the indexing variable
function_return_linter
Lint common mistakes/style issues cropping up from return statements
implicit_assignment_linter
implicit_assignment
is_numeric_linter
Redirect is.numeric(x) || is.integer(x) to just use is.numeric(x)
length_levels_linter
Require usage of nlevels over length(levels(.))
length_test_linter
Check for a common mistake where length is applied in the wrong place
lengths_linter
Require usage of lengths() where possible
library_call_linter
Library call linter
literal_coercion_linter
Require usage of correctly-typed literals over literal coercions
matrix_apply_linter
Require usage of colSums(x) or rowSums(x) over apply(x, ., sum)
missing_argument_linter
Missing argument linter
nested_ifelse_linter
Block usage of nested ifelse() calls
numeric_leading_zero_linter
Require usage of a leading zero in all fractional numerics
outer_negation_linter
Require usage of !any(x) over all(!x), !all(x) over any(!x)
package_hooks_linter
Package hooks linter
paste_linter
Raise lints for several common poor usages of paste()
redundant_equals_linter
Block usage of ==, != on logical vectors
redundant_ifelse_linter
Prevent ifelse() from being used to produce TRUE/FALSE or 1/0
right_assignment_linter
right_assignment
semicolon_linter
Semicolon linter
seq_linter
Sequence linter
sort_linter
Check for common mistakes around sorting vectors
todo_comment_linter
TODO comment linter
undesirable_function_linter
Undesirable function linter
undesirable_operator_linter
Undesirable operator linter
unnecessary_nesting_linter
Block instances of unnecessary nesting
unreachable_code_linter
Block unreachable code and comments following return statements