Package: flir 0.6.0

flir: Find and Fix Lints in R Code

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.

Authors:Etienne Bacher [aut, cre, cph], lintr authors [aut], Trevor L. Davis [ctb]

flir_0.6.0.tar.gz
flir_0.6.0.zip(r-4.7)flir_0.6.0.zip(r-4.6)flir_0.6.0.zip(r-4.5)
flir_0.6.0.tgz(r-4.6-any)flir_0.6.0.tgz(r-4.5-any)
flir_0.6.0.tar.gz(r-4.7-any)flir_0.6.0.tar.gz(r-4.6-any)
flir_0.6.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
flir/json (API)
NEWS

# Install 'flir' in R:
install.packages('flir', repos = c('https://etiennebacher.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/etiennebacher/flir/issues

Pkgdown/docs site:https://flir.etiennebacher.com

On CRAN:

Conda:

7.72 score 88 stars 8 scripts 249 downloads 65 exports 12 dependencies

Last updated from:9254cd01d2 (on v0.6.0). Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK161
source / vignettesOK212
linux-release-x86_64OK189
macos-release-arm64OK193
macos-oldrel-arm64OK182
windows-develOK149
windows-releaseOK146
windows-oldrelOK134
wasm-releaseOK133

Exports:add_new_ruleany_duplicated_linterany_is_na_linterclass_equals_lintercondition_message_linterdouble_assignment_linterduplicate_argument_linterempty_assignment_linterequal_assignment_linterequals_na_linterexpect_comparison_linterexpect_identical_linterexpect_length_linterexpect_named_linterexpect_not_linterexpect_null_linterexpect_s3_class_linterexpect_s4_class_linterexpect_true_false_linterexpect_type_linterexport_new_rulefixfix_dirfix_packagefix_textfor_loop_index_linterfunction_return_linterimplicit_assignment_linteris_numeric_linterlength_levels_linterlength_test_linterlengths_linterlibrary_call_linterlintlint_dirlint_packagelint_textlist_comparison_linterlist_lintersliteral_coercion_lintermatrix_apply_lintermissing_argument_linternested_ifelse_linternumeric_leading_zero_linternzchar_linterouter_negation_linterpackage_hooks_linterpaste_linterredundant_equals_linterredundant_ifelse_linterrep_len_linterright_assignment_lintersample_int_linterseq_lintersetup_flirsetup_flir_ghasort_linterstopifnot_all_linterT_and_F_symbol_lintertodo_comment_linterundesirable_function_linterundesirable_operator_linterunnecessary_nesting_lintervector_logic_linterwhich_grepl_linter

Dependencies:astgreprbackportscheckmateclicrayondata.tabledigestfsgit2rrprojrootrrapplyyaml

Adding new rules

Rendered fromadding_rules.Rmdusingknitr::rmarkdownon May 14 2026.

Last update: 2025-06-16
Started: 2024-07-01

Automatic fixes

Rendered fromautomatic_fixes.Rmdusingknitr::rmarkdownon May 14 2026.

Last update: 2025-06-09
Started: 2025-05-22

Sharing rules across packages

Rendered fromsharing_rules.Rmdusingknitr::rmarkdownon May 14 2026.

Last update: 2025-06-16
Started: 2025-06-12

Tips and tricks

Rendered fromtips-and-tricks.Rmdusingknitr::rmarkdownon May 14 2026.

Last update: 2025-06-30
Started: 2025-06-29

Readme and manuals

Help Manual

Help pageTopics
Create a custom rule for internal useadd_new_rule
Require usage of 'anyDuplicated(x) > 0' over 'any(duplicated(x))'any_duplicated_linter
Require usage of 'anyNA(x)' over 'any(is.na(x))'any_is_na_linter
Block comparison of class with '=='class_equals_linter
Block usage of 'paste()' and 'paste0()' with messaging functions using '...'condition_message_linter
double_assignmentdouble_assignment_linter
Duplicate argument linterduplicate_argument_linter
empty_assignmentempty_assignment_linter
equal_assignmentequal_assignment_linter
Equality check with NA linterequals_na_linter
Require usage of 'expect_gt(x, y)' over 'expect_true(x > y)' (and similar)expect_comparison_linter
Require usage of 'expect_identical(x, y)' where appropriateexpect_identical_linter
Require usage of 'expect_length(x, n)' over 'expect_equal(length(x), n)'expect_length_linter
Require usage of 'expect_named(x, n)' over 'expect_equal(names(x), n)'expect_named_linter
Require usage of 'expect_false(x)' over 'expect_true(!x)'expect_not_linter
Require usage of 'expect_null' for checking 'NULL'expect_null_linter
Require usage of 'expect_s3_class()'expect_s3_class_linter
Require usage of 'expect_s4_class(x, k)' over 'expect_true(is(x, k))'expect_s4_class_linter
Require usage of 'expect_true(x)' over 'expect_equal(x, TRUE)'expect_true_false_linter
Require usage of 'expect_type(x, type)' over 'expect_equal(typeof(x), type)'expect_type_linter
Create a custom rule for external useexport_new_rule
Automatically replace lintsfix fix_dir fix_package fix_text
Block usage of for loops directly overwriting the indexing variablefor_loop_index_linter
Lint common mistakes/style issues cropping up from return statementsfunction_return_linter
implicit_assignmentimplicit_assignment_linter
Redirect 'is.numeric(x) || is.integer(x)' to just use 'is.numeric(x)'is_numeric_linter
Require usage of nlevels over length(levels(.))length_levels_linter
Check for a common mistake where length is applied in the wrong placelength_test_linter
Require usage of 'lengths()' where possiblelengths_linter
Library call linterlibrary_call_linter
List all lints in a file or a directorylint lint_dir lint_package lint_text
Block usage of comparison operators with known-list() functions like lapplylist_comparison_linter
Get the list of linters in 'flir'list_linters
Require usage of correctly-typed literals over literal coercionsliteral_coercion_linter
Require usage of 'colSums(x)' or 'rowSums(x)' over 'apply(x, ., sum)'matrix_apply_linter
Missing argument lintermissing_argument_linter
Block usage of nested 'ifelse()' callsnested_ifelse_linter
Require usage of a leading zero in all fractional numericsnumeric_leading_zero_linter
Require usage of nzchar where appropriatenzchar_linter
Require usage of '!any(x)' over 'all(!x)', '!all(x)' over 'any(!x)'outer_negation_linter
Package hooks linterpackage_hooks_linter
Raise lints for several common poor usages of 'paste()'paste_linter
Block usage of '==', '!=' on logical vectorsredundant_equals_linter
Prevent 'ifelse()' from being used to produce 'TRUE'/'FALSE' or '1'/'0'redundant_ifelse_linter
Require usage of rep_len(x, n) over rep(x, length.out = n)rep_len_linter
right_assignmentright_assignment_linter
Require usage of sample.int(n, m, ...) over sample(1:n, m, ...)sample_int_linter
Sequence linterseq_linter
Setup flirsetup_flir
Create a Github Actions workflow for 'flir'setup_flir_gha
Check for common mistakes around sorting vectorssort_linter
Block usage of all() within stopifnot()stopifnot_all_linter
'T' and 'F' symbol linterT_and_F_symbol_linter
TODO comment lintertodo_comment_linter
Undesirable function linterundesirable_function_linter
Undesirable operator linterundesirable_operator_linter
Block instances of unnecessary nestingunnecessary_nesting_linter
Enforce usage of scalar logical operators in conditional statementsvector_logic_linter
Require usage of grep over which(grepl(.))which_grepl_linter