Code quality remains an abstract concept that fails to get traction at the business level. Consequently, software companies keep trading code quality for time-to-market and new features. The resulting technical debt is estimated to waste up to 42% of developers’ time. At the same time, there is a global shortage of software developers, meaning that developer productivity is key to software businesses. Our overall mission is to make code quality a business concern, not just a technical aspect. Our first goal is to understand how code quality impacts 1) the number of reported defects, 2) the time to resolve issues, and 3) the predictability of resolving issues on time. We analyze 39 proprietary production codebases from a variety of domains using the CodeScene tool based on a combination of source code analysis, version-control mining, and issue information from Jira. By analyzing activity in 30,737 files, we find that low quality code contains 15 times more defects than high quality code. Furthermore, resolving issues in low quality code takes on average 124% more time in development. Finally, we report that issue resolutions in low quality code involve higher uncertainty manifested as 9 times longer maximum cycle times. This study provides evidence that code quality cannot be dismissed as a technical concern. With 15 times fewer defects, twice the development speed, and substantially more predictable issue resolution times, the business advantage of high quality code should be unmistakably clear.
There are numerous studies on code quality metrics [5, 52].
Al-though primarily used to communicate how comprehensive a soft-ware solution is or how much work a development task would require, Lines of Code (LoC) metrics are often involved also in code quality metrics [2].
An underlying assumption is that the higher LoC a file has file, the more complex it is. Also within the scope of our research, we assume that making a change in a large file would typically require more effort than in a smaller file.
To verify that assumption, we prepared our research by investigating if LoC could be used to predict issue resolution times in our data set (further de-scribed in Section 4.2).
We found a low Pearson correlation (r=0.13) between added LoC and the average issue resolution time in corre-sponding files.
To confirm that CodeScene’s Code Health adds predictive value beyond LoC, we analyzed its correlation with issue resolution times for our data set. Analogous to LoC counterpart, we calculated the Pearson correlation between the raw Code Health scores (10.0 down to 1.0) and the average issue resolution times in corresponding files. We found a higher degree of correlation (r=-0.58) and conclude that Code Health is a valid metric for this study.