Why you should care
Managing software complexity is an art of balancing the different natures of complexity that code can exhibit. Ensuring that logical operators are not too frequently complex within logical conditions is one way to help developers spend more time adding new features instead of trying to figure out how to interpret when a condition is applicable. Ideally, simple combinations of logical operators makes the code easier to understand, adapt and fix, even if the source file is complex overall.
In the context of this code insight, some IFs could be added in order to reduce the abnormally high ratio between logical operators and conditions. Associated with another code insight that exclusively focuses on conditions complexity (Cyclomatic Complexity), these two complexity insights will help you find a good compromise between operators’ complexity and conditional complexity.
How we detect
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.