The code contains non-wrapped immediate function calls

Why you should care

When a function is to be invoked immediately, the entire invocation expression should be wrapped in parents. Wrapping an immediate function invocation in parentheses is usefull to assist the reader in understanding that the expression is the result of a function, and not the function itself.

How we detect

CAST Highlight counts one occurrence each time a function called immediatelly is not wrapped into parenthesis. This concerns only function expression, not function declarations.

Bad Code 

var collection = function () {
        [ some code ]

} ();

Good Code 

var collection = (function () {
        [ some code ]

} ());



About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.