apple / apple-llvm-infrastructure-tools
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 460 units with 5,789 lines of code in units (76.1% of code).
    • 2 very complex units (286 lines of code)
    • 5 complex units (430 lines of code)
    • 31 medium complex units (1,445 lines of code)
    • 46 simple units (1,185 lines of code)
    • 376 very simple units (2,443 lines of code)
4% | 7% | 24% | 20% | 42%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
h7% | 6% | 30% | 18% | 36%
cpp0% | 31% | 13% | 29% | 25%
py0% | 0% | 15% | 20% | 63%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src6% | 9% | 28% | 20% | 35%
git_apple_llvm/am0% | 0% | 25% | 20% | 54%
git_apple_llvm/git_tools0% | 0% | 18% | 26% | 55%
git_apple_llvm/pr0% | 0% | 0% | 27% | 72%
git_apple_llvm/ci0% | 0% | 0% | 0% | 100%
src/tools0% | 0% | 0% | 0% | 100%
git_apple_llvm/config0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
int commit_interleaver::merge_targets()
in src/commit_interleaver.h
177 54 2
109 53 0
134 50 3
104 40 5
static int main_upstream()
in src/split2mono.cpp
72 30 3
int table_streams::init()
in src/data_query.h
56 29 5
64 27 6
58 22 1
84 20 1
68 19 8
58 19 10
static int main_create()
in src/split2mono.cpp
40 19 3
int dir_list::add_dir()
in src/dir_list.h
37 18 3
45 17 1
static unsigned char convert()
in src/sha1convert.h
24 17 1
47 17 2
def print_status()
in git_apple_llvm/am/am_status.py
46 16 5
int commit_interleaver::compare_trees()
in src/commit_interleaver.h
32 16 4
67 16 2
39 16 1