Skip to contents

Check that while (TRUE) is not used for infinite loops.

Usage

repeat_linter()

See also

linters for a complete list of linters available in lintr.

Examples

# will produce lints
lint(
  text = "while (TRUE) { }",
  linters = repeat_linter()
)
#> <text>:1:1: style: [repeat_linter] Use 'repeat' instead of 'while (TRUE)' for infinite loops.
#> while (TRUE) { }
#> ^~~~~~~~~~~~


# okay
lint(
  text = "repeat { }",
  linters = repeat_linter()
)
#>  No lints found.