flir0.6.0 package

Find and Fix Lints in R Code

add_new_rule

Create a custom rule for internal use

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 ==

condition_message_linter

Block usage of paste() and paste0() with messaging functions using...

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 simi...

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_s3_class_linter

Require usage of expect_s3_class()

expect_s4_class_linter

Require usage of expect_s4_class(x, k) over expect_true(is(x, k))

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), ...

export_new_rule

Create a custom rule for external use

fix

Automatically replace lints

flir-package

flir: Find and Fix Lints in R Code

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

lint

List all lints in a file or a directory

list_comparison_linter

Block usage of comparison operators with known-list() functions like l...

list_linters

Get the list of linters in flir

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

nzchar_linter

Require usage of nzchar where appropriate

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...

rep_len_linter

Require usage of rep_len(x, n) over rep(x, length.out = n)

right_assignment_linter

right_assignment

sample_int_linter

Require usage of sample.int(n, m, ...) over sample(1:n, m, ...)

seq_linter

Sequence linter

setup_flir_gha

Create a Github Actions workflow for flir

setup_flir

Setup flir

sort_linter

Check for common mistakes around sorting vectors

stopifnot_all_linter

Block usage of all() within stopifnot()

T_and_F_symbol_linter

T and F symbol linter

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

vector_logic_linter

Enforce usage of scalar logical operators in conditional statements

which_grepl_linter

Require usage of grep over which(grepl(.))

Lints are code patterns that are not optimal because they are inefficient, forget corner cases, or are less readable. 'flir' provides a small set of functions to detect those lints and automatically fix them. It builds on 'astgrepr', which itself uses the 'Rust' crate 'ast-grep' to parse and navigate R code.

  • Maintainer: Etienne Bacher
  • License: MIT + file LICENSE
  • Last published: 2025-12-14