Bug 17180 - R CMD check should detect misuse of return
Summary: R CMD check should detect misuse of return
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Wishlist (show other bugs)
Version: R 3.3.0
Hardware: Other Other
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2016-11-13 20:01 UTC by Duncan Murdoch
Modified: 2016-11-13 20:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Murdoch 2016-11-13 20:01:30 UTC
I just did a search across CRAN, and found 111 packages with code like

if (condition) return

instead of 

if (condition) return()

We should add a code check for this.  

A related error is harder to detect:

return (expr1)*(expr2)

instead of

return( (expr1)*(expr2) )

(or variations with other operators).  I suspect this is less common, but I might just have the wrong search code for it.