Reading Beside the Lines: Indentation as a Proxy for Complexity Metric

A. Hindle, M.W. Godfrey, R.C. Holt
<span title="">2008</span> <i title="IEEE"> <a target="_blank" rel="noopener" href="https://fatcat.wiki/container/cmtxa734ezfojns2jrwgh64rym" style="color: black;">2008 16th IEEE International Conference on Program Comprehension</a> </i> &nbsp;
Maintainers face the daunting task of wading through a collection of both new and old revisions, trying to ferret out revisions which warrant personal inspection. One can rank revisions by size/lines of code (LOC), but often, due to the distribution of the size of changes, revisions will be of similar size. If we can't rank revisions by LOC perhaps we can rank by Halstead's and McCabe's complexity metrics? However, these metrics are problematic when applied to code fragments (revisions) written
more &raquo; ... in multiple languages: special parsers are required which may not support the language or dialect used; analysis tools may not understand code fragments. We propose using the statistical moments of indentation as a lightweight, language independent, revision/diff friendly metric which actually proxies classical complexity metrics. We have extensively evaluated our approach against the entire CVS histories of the 278 of the most popular and most active SourceForge projects. We found that our results are linearly correlated and rankcorrelated with traditional measures of complexity, suggesting that measuring indentation is a cheap and accurate proxy for code complexity of revisions. Thus ranking revisions by the standard deviation and summation of indentation will be very similar to ranking revisions by complexity.
<span class="external-identifiers"> <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/10.1109/icpc.2008.13">doi:10.1109/icpc.2008.13</a> <a target="_blank" rel="external noopener" href="https://dblp.org/rec/conf/iwpc/HindleGH08.html">dblp:conf/iwpc/HindleGH08</a> <a target="_blank" rel="external noopener" href="https://fatcat.wiki/release/dkknkl2byvavbea3bktmddzkki">fatcat:dkknkl2byvavbea3bktmddzkki</a> </span>
<a target="_blank" rel="noopener" href="https://web.archive.org/web/20161007081538/http://plg.uwaterloo.ca/~migod/papers/2008/icpc08-abram.pdf" title="fulltext PDF download" data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"> <button class="ui simple right pointing dropdown compact black labeled icon button serp-button"> <i class="icon ia-icon"></i> Web Archive [PDF] <div class="menu fulltext-thumbnail"> <img src="https://blobs.fatcat.wiki/thumbnail/pdf/a1/51/a1514b3eb80d88ba27250db84dc7a7b8e7b12058.180px.jpg" alt="fulltext thumbnail" loading="lazy"> </div> </button> </a> <a target="_blank" rel="external noopener noreferrer" href="https://doi.org/10.1109/icpc.2008.13"> <button class="ui left aligned compact blue labeled icon button serp-button"> <i class="external alternate icon"></i> ieee.com </button> </a>