Avoid methods or function with too many local variables

This code insight counts one occurrence for each local variable in methods and functions found during the scan and shows up in CAST Highlight results when specific thresholds (ratio of local variables vs. total number of functions/methods) are reached for a given file, compared to the average ratio observed in other applications in the benchmark.
5362

Why you should care

Implementing too many local variables can make code more complex.

CAST recommendations

Reduce the total number of parameters by subdividing your functions into more specialized and granular artifacts.

References

5362

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.