The evaluation and mitigation of the complexity of computer programs are important tasks in the software life cycle. McCabe’s cyclomatic complexity (MCC) is a widely used metric for the control flow complexity of computer programs. High-MCC functions in the Linux kernel may bring about research questions, such as: “What causes the high MCC counts?” What is the relationship between the MCC metric and other complexity metrics? “Do the high-MCC functions indicate code quality problems?” Can some of the high-MCC code be replaced or refined?
The authors survey research papers and do experiments to try to answer the questions. They use the pmccabe tool to research the character and distribution of MCC in the Linux kernel. The “correlation of MCC with other metrics” is also researched. Lines of code (LOC) and MCC are correlated. However, there is almost no correlation of MCC with the average level of indentation or nesting. Experiments show “little correlation between MCC and perceived complexity for high-MCC functions.” The results also show that there is a weak negative correlation between reduction of raw code and perceived complexity. As high-MCC functions are long, it is a good opportunity for applying refactoring techniques such as function extraction.
The main contribution of this paper is its analysis and summary of the challenges of high-MCC functions in the Linux kernel. Experiments show that the MCC metric may not reflect the control flow complexity of computer programs precisely. Alternative metrics or a refined MCC metric should be proposed to evaluate the complexity of computer programs in the Linux kernel.