Repository navigation
[Linting Rule] Bogus Return
Generated from 'wiki-linter.ts' on 2026-10-25, 09:29:25 UTC (v2.16.6), do not edit directly.
Bogus Return [overview]
This rule ports the following steps of R CMD check (see the conformance table for the legend):
| # | Step | Coverage | Note |
|---|---|---|---|
| 37 | R code for possible problems (book) | 🟩⭐ | ⭐ also quick fixes, deprecated arguments, environments resolved through variables, hooks followed into callees |
This rule is a exact rule.
Finds a bare return (without ()), which evaluates to the function return instead of returning. Offers return() as a quick fix.
This linting rule is implemented in src/linter/rules/cmd-check/bogus-return.ts.
f <- function(x) {
if(is.null(x)) return
x + 1
}The linting query can be used to run this rule on the above example:
[ { "type": "linter", "rules": [ { "name": "bogus-return", "config": {} } ] } ]Results (prettified and summarized):
Query: linter (1 ms)
╰ Bogus Return (bogus-return):
╰ certain:
╰ Bare return at 2.17-22 (1 quick fix(es) available)
More examples are the test cases in test/functionality/linter/cmd-check/lint-bogus-return.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