Repository navigation
[Linting Rule] Useless Loop
Generated from 'wiki-linter.ts' on 2026-10-27, 10:46:55 UTC (v2.16.6), do not edit directly.
Useless Loops [overview]
This rule is a best-effort rule.
Finds loops that iterate only once.
This linting rule is implemented in src/linter/rules/useless-loop.ts.
Linting rules can be configured by passing a configuration object to the linter query as shown in the example below.
The useless-loop rule accepts the following configuration options:
-
loopyFunctions
Function origins that are considered loops
for(i in c(1)) { print(i) }The linting query can be used to run this rule on the above example:
[ { "type": "linter", "rules": [ { "name": "useless-loop", "config": {} } ] } ]Results (prettified and summarized):
Query: linter (2 ms)
╰ Useless Loops (useless-loop):
╰ certain:
╰ for-loop at 1.1-27 only loops once
More examples are the test cases in test/functionality/linter/lint-useless-loop.test.ts.
Currently maintained by Florian Sihler and Oliver Gerstl at Ulm University
Email | GitHub | Penguins | Portfolio
- 🧑💻 Developer Onboarding
- 💻 Setup
- 👓 Overview
- 🪟 Interfacing with flowR
- 🌋 Core
- 🧹 Testing & Linting (Benchmark Page)
⁉️ FAQ- ℹ️ Extra Information