Package: lintr 3.1.2.9000

Michael Chirico

lintr: A 'Linter' for R Code

Checks adherence to a given style, syntax errors and possible semantic issues. Supports on the fly checking of R code edited with 'RStudio IDE', 'Emacs', 'Vim', 'Sublime Text', 'Atom' and 'Visual Studio Code'.

Authors:Jim Hester [aut], Florent Angly [aut], Russ Hyde [aut], Michael Chirico [aut, cre], Kun Ren [aut], Alexander Rosenstock [aut], Indrajeet Patil [aut]

lintr_3.1.2.9000.tar.gz
lintr_3.1.2.9000.zip(r-4.5)lintr_3.1.2.9000.zip(r-4.4)lintr_3.1.2.9000.zip(r-4.3)
lintr_3.1.2.9000.tgz(r-4.4-any)lintr_3.1.2.9000.tgz(r-4.3-any)
lintr_3.1.2.9000.tar.gz(r-4.5-noble)lintr_3.1.2.9000.tar.gz(r-4.4-noble)
lintr_3.1.2.9000.tgz(r-4.4-emscripten)lintr_3.1.2.9000.tgz(r-4.3-emscripten)
lintr.pdf |lintr.html
lintr/json (API)
NEWS

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

Peer review:

Bug tracker:https://github.com/r-lib/lintr/issues

On CRAN:

linter

157 exports 1.2k stars 9.89 score 15 dependencies 32 dependents 85.1k downloads

Last updated 3 days agofrom:3419159633067d2e6799854ec3cf5ff31bce15d0

Exports:absolute_path_linterall_lintersall_undesirable_functionsall_undesirable_operatorsany_duplicated_linterany_is_na_linterassignment_linteravailable_lintersavailable_tagsbackport_linterboolean_arithmetic_linterbrace_lintercheckstyle_outputclass_equals_linterclear_cacheclosed_curly_lintercommas_lintercommented_code_lintercomparison_negation_lintercondition_call_lintercondition_message_linterconjunct_test_linterconsecutive_assertion_linterconsecutive_mutate_linterconsecutive_stopifnot_lintercyclocomp_linterdefault_lintersdefault_settingsdefault_undesirable_functionsdefault_undesirable_operatorsduplicate_argument_linterempty_assignment_linterequals_na_linterexpect_comparison_linterexpect_identical_linterexpect_length_linterexpect_lintexpect_lint_freeexpect_named_linterexpect_no_lintexpect_not_linterexpect_null_linterexpect_s3_class_linterexpect_s4_class_linterexpect_true_false_linterexpect_type_linterextraction_operator_linterfixed_regex_linterfor_loop_index_linterfunction_argument_linterfunction_left_parentheses_linterfunction_return_linterget_r_stringget_source_expressionsids_with_tokenif_not_else_linterif_switch_linterifelse_censor_linterimplicit_assignment_linterimplicit_integer_linterindentation_linterinfix_spaces_linterinner_combine_linteris_lint_levelis_numeric_linterkeyword_quote_linterlength_levels_linterlength_test_linterlengths_linterlibrary_call_linterline_length_linterlintLintlint_dirlint_packageLinterlinters_with_defaultslinters_with_tagslist_comparison_linterliteral_coercion_lintermake_linter_from_function_xpathmake_linter_from_xpathmatrix_apply_lintermissing_argument_lintermissing_package_lintermodify_defaultsnamespace_linternested_ifelse_linternested_pipe_linterno_tab_linternonportable_path_linternrow_subset_linternumeric_leading_zero_linternzchar_linterobject_length_linterobject_name_linterobject_overwrite_linterobject_usage_linterone_call_pipe_linteropen_curly_linterouter_negation_linterpackage_hooks_linterparen_body_linterparen_brace_linterpaste_linterpipe_call_linterpipe_consistency_linterpipe_continuation_linterpipe_return_linterprint_linterquotes_linterredundant_equals_linterredundant_ifelse_linterregex_subset_linterrep_len_linterrepeat_linterreturn_linterroutine_registration_lintersample_int_lintersarif_outputscalar_in_lintersemicolon_lintersemicolon_terminator_linterseq_lintersingle_quotes_lintersort_linterspaces_inside_linterspaces_left_parentheses_lintersprintf_linterstopifnot_all_linterstring_boundary_linterstrings_as_factors_lintersystem_file_linterT_and_F_symbol_linterterminal_close_lintertodo_comment_lintertrailing_blank_lines_lintertrailing_whitespace_linterundesirable_function_linterundesirable_operator_linterunnecessary_concatenation_linterunnecessary_lambda_linterunnecessary_nested_if_linterunnecessary_nesting_linterunnecessary_placeholder_linterunneeded_concatenation_linterunreachable_code_linterunused_import_linteruse_lintrvector_logic_linterwhich_grepl_linterwhitespace_linterwith_defaultswith_idxml_nodes_to_lintsxp_call_nameyoda_test_linter

Dependencies:backportsclicodetoolsdigestevaluategluehighrknitrlazyevalrexrlangxfunxml2xmlparsedatayaml

Continuous integration

Rendered fromcontinuous-integration.Rmdusingknitr::rmarkdownon Jun 28 2024.

Last update: 2024-02-29
Started: 2022-05-24

Creating new linters

Rendered fromcreating_linters.Rmdusingknitr::rmarkdownon Jun 28 2024.

Last update: 2024-06-22
Started: 2014-11-04

Editor setup

Rendered fromeditors.Rmdusingknitr::rmarkdownon Jun 28 2024.

Last update: 2022-10-23
Started: 2022-05-24

Using lintr

Rendered fromlintr.Rmdusingknitr::rmarkdownon Jun 28 2024.

Last update: 2024-06-22
Started: 2022-05-24

Readme and manuals

Help Manual

Help pageTopics
Absolute path linterabsolute_path_linter
Create a linter configuration based on all available lintersall_linters
Default undesirable functions and operatorsall_undesirable_functions all_undesirable_operators default_undesirable_functions default_undesirable_operators
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
Assignment linterassignment_linter
Get Linter metadata from a packageavailable_linters available_tags
Backport linterbackport_linter
Best practices lintersbest_practices_linters
Require usage of boolean operators over equivalent arithmeticboolean_arithmetic_linter
Brace linterbrace_linter
Checkstyle Report for lint resultscheckstyle_output
Block comparison of class with '=='class_equals_linter
Clear the lintr cacheclear_cache
Commas lintercommas_linter
Commented code lintercommented_code_linter
Common mistake linterscommon_mistakes_linters
Block usages like !(x == y) where a direct relational operator is appropriatecomparison_negation_linter
Recommend usage of 'call. = FALSE' in conditionscondition_call_linter
Block usage of 'paste()' and 'paste0()' with messaging functions using '...'condition_message_linter
Configurable lintersconfigurable_linters
Force '&&' conditions to be written separately where appropriateconjunct_test_linter
Force consecutive calls to assertions into just one when possibleconsecutive_assertion_linter
Require consecutive calls to mutate() to be combined when possibleconsecutive_mutate_linter
Consistency lintersconsistency_linters
Correctness linterscorrectness_linters
Cyclomatic complexity lintercyclocomp_linter
Default lintersdefault_linters
Default lintr settings.lintr config default_settings lintr-config lintr-settings settings
Deprecated lintersdeprecated_linters
Duplicate argument linterduplicate_argument_linter
Efficiency lintersefficiency_linters
Block assignment of '{}'empty_assignment_linter
Equality check with NA linterequals_na_linter
Code executing lintersexecuting_linters
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
Lint expectationexpect_lint expect_no_lint
Test that the package is lint freeexpect_lint_free
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
Require usage of 'fixed=TRUE' in regular expressions where appropriatefixed_regex_linter
Block usage of for loops directly overwriting the indexing variablefor_loop_index_linter
Function argument linterfunction_argument_linter
Function left parentheses linterfunction_left_parentheses_linter
Lint common mistakes/style issues cropping up from return statementsfunction_return_linter
Extract text from 'STR_CONST' nodesget_r_string
Parsed sourced file from a filenameget_source_expressions
Get parsed IDs by tokenids_with_token with_id
Block statements like if (!A) x else yif_not_else_linter
Require usage of switch() over repeated if/else blocksif_switch_linter
Block usage of 'ifelse()' where 'pmin()' or 'pmax()' is more appropriateifelse_censor_linter
Avoid implicit assignment in function callsimplicit_assignment_linter
Implicit integer linterimplicit_integer_linter
Check that indentation is consistentindentation_linter
Infix spaces linterinfix_spaces_linter
Require 'c()' to be applied before relatively expensive vectorized functionsinner_combine_linter
Is this an expression- or a file-level source object?is_lint_level
Redirect 'is.numeric(x) || is.integer(x)' to just use 'is.numeric(x)'is_numeric_linter
Block unnecessary quoting in callskeyword_quote_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
Line length linterline_length_linter
Lint a file, directory, or packagelint lint_dir lint_package
Create a 'lint' objectLint lint-s3
Create a 'linter' closureLinter
Available linterslinters
Create a linter configuration based on defaultslinters_with_defaults
Create a tag-based linter configurationlinters_with_tags
Block usage of comparison operators with known-list() functions like lapplylist_comparison_linter
Require usage of correctly-typed literals over literal coercionsliteral_coercion_linter
Create a linter from an XPathmake_linter_from_function_xpath make_linter_from_xpath
Require usage of 'colSums(x)' or 'rowSums(x)' over 'apply(x, ., sum)'matrix_apply_linter
Missing argument lintermissing_argument_linter
Missing package lintermissing_package_linter
Modify lintr defaultsmodify_defaults
Namespace linternamespace_linter
Block usage of nested 'ifelse()' callsnested_ifelse_linter
Block usage of pipes nested inside other callsnested_pipe_linter
Non-portable path linternonportable_path_linter
Block usage of 'nrow(subset(x, .))'nrow_subset_linter
Require usage of a leading zero in all fractional numericsnumeric_leading_zero_linter
Require usage of nzchar where appropriatenzchar_linter
Object length linterobject_length_linter
Object name linterobject_name_linter
Block assigning any variables whose name clashes with a 'base' R functionobject_overwrite_linter
Object usage linterobject_usage_linter
Block single-call magrittr pipesone_call_pipe_linter
Require usage of '!any(x)' over 'all(!x)', '!all(x)' over 'any(!x)'outer_negation_linter
Package development linterspackage_development_linters
Package hooks linterpackage_hooks_linter
Parenthesis before body linterparen_body_linter
Raise lints for several common poor usages of 'paste()'paste_linter
Pipe call linterpipe_call_linter
Pipe consistency linterpipe_consistency_linter
Pipe continuation linterpipe_continuation_linter
Block usage of return() in magrittr pipelinespipe_return_linter
Testthat linterspkg_testthat_linters
Block usage of print() for loggingprint_linter
Character string quote linterquotes_linter
Read lintr settingsread_settings
Readability lintersreadability_linters
Block usage of '==', '!=' on logical vectorsredundant_equals_linter
Prevent 'ifelse()' from being used to produce 'TRUE'/'FALSE' or '1'/'0'redundant_ifelse_linter
Regular expression lintersregex_linters
Require usage of direct methods for subsetting strings via regexregex_subset_linter
Require usage of rep_len(x, n) over rep(x, length.out = n)rep_len_linter
Repeat linterrepeat_linter
Return linterreturn_linter
Robustness lintersrobustness_linters
Identify unregistered native routinesroutine_registration_linter
Require usage of sample.int(n, m, ...) over sample(1:n, m, ...)sample_int_linter
SARIF Report for lint resultssarif_output
Block usage like x %in% "a"scalar_in_linter
Semicolon lintersemicolon_linter
Sequence linterseq_linter
Check for common mistakes around sorting vectorssort_linter
Spaces inside linterspaces_inside_linter
Spaces before parentheses linterspaces_left_parentheses_linter
Require correct 'sprintf()' callssprintf_linter
Block usage of all() within stopifnot()stopifnot_all_linter
Require usage of 'startsWith()' and 'endsWith()' over 'grepl()'/'substr()' versionsstring_boundary_linter
Identify cases where 'stringsAsFactors' should be supplied explicitlystrings_as_factors_linter
Style lintersstyle_linters
Block usage of 'file.path()' with 'system.file()'system_file_linter
'T' and 'F' symbol linterT_and_F_symbol_linter
Prohibit close() from terminating a function definitionterminal_close_linter
Tidyverse design linterstidy_design_linters
TODO comment lintertodo_comment_linter
Trailing blank lines lintertrailing_blank_lines_linter
Trailing whitespace lintertrailing_whitespace_linter
Undesirable function linterundesirable_function_linter
Undesirable operator linterundesirable_operator_linter
Unneeded concatenation linterunnecessary_concatenation_linter
Block usage of anonymous functions in iteration functions when unnecessaryunnecessary_lambda_linter
Block instances of unnecessary nestingunnecessary_nesting_linter
Block usage of pipeline placeholders if unnecessaryunnecessary_placeholder_linter
Block unreachable code and comments following return statementsunreachable_code_linter
Check that imported packages are actually usedunused_import_linter
Use lintr in your projectuse_lintr
Enforce usage of scalar logical operators in conditional statementsvector_logic_linter
Require usage of grep over which(grepl(.))which_grepl_linter
Whitespace linterwhitespace_linter
Convert an XML node or nodeset into a Lintxml_nodes_to_lints
Get the name of the function matched by an XPathxp_call_name
Block obvious "yoda tests"yoda_test_linter