Structural code complexity may be too high
This code insight – derived from Tom McCabe’s Cyclomatic Complexity – estimates the level of strutural complexity of a piece of source code by counting and summing the total number of logical conditions (if, while, for, case, default), functions and methods. Depending on specific thresholds CAST has developed for each technology, Highlight counts penalty points for the scanned file.
Why you should care
Code complexity is the “arthritis” of software. If not managed by your development teams, it can quickly impact many aspects of your applications such as: a) maintainability; b) the ability to add new features because the underlying code foundation is just too complex; and c) the testability and the corresponding QA effort.
More importantly, it is generally agreed that a high level of code complexity correlates with the number of introduced software defects, since it’s very difficult for a developer to decipher many conditions at the same time while modifying a code base.
Long story short, software complexity is error-prone and means higher maintenance and test costs.
Although code complexity could be considered as part of the software entropy (software quality tends to naturally decreases over time), it is also part of your technical debt. You should ensure your team takes care of controlling structural complexity overy time by regularly refactoring the most complex parts of your source 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.