Why you should care
Too many functions can also lead to bigger file sizes which leads to reduced compactness of the code.
Further increasing the complexity of the code can harm the business-applications of the code in terms of overall productivity and it’s speed. Code that is incredibly complex might not grow and evolve.
CAST recommends limiting the number of literal functions assigned to global variables as well as lowering the amount of declaring global functions. It is fine to incorporate inner functions and literal functions without assigning them to global variables to ensure the code can provide accelerated progress for the portfolio.
How we detect
- global functions declarations
- literal functions assigned to global var.
Are not concerned :
- inner functions
- literal functions (if assigned to local var)
- anonymous functions (if assigned to local var)
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.