facebook / ThreatExchange
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 2,207 units with 25,687 lines of code in units (56.4% of code).
    • 0 very complex units (0 lines of code)
    • 12 complex units (1,231 lines of code)
    • 72 medium complex units (4,709 lines of code)
    • 101 simple units (3,698 lines of code)
    • 2,022 very simple units (16,049 lines of code)
0% | 4% | 18% | 14% | 62%
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
java0% | 11% | 28% | 10% | 49%
py0% | 3% | 13% | 12% | 69%
rb0% | 13% | 48% | 15% | 23%
cpp0% | 0% | 18% | 11% | 70%
php0% | 0% | 18% | 24% | 57%
tsx0% | 0% | 5% | 25% | 68%
c0% | 0% | 23% | 15% | 61%
go0% | 0% | 51% | 0% | 48%
h0% | 0% | 0% | 12% | 87%
js0% | 0% | 0% | 0% | 100%
ts0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
api-reference-examples/java0% | 13% | 31% | 8% | 46%
api-reference-examples/python0% | 13% | 33% | 14% | 38%
pdq/java0% | 9% | 24% | 14% | 52%
api-reference-examples/ruby0% | 13% | 48% | 15% | 23%
hasher-matcher-actioner/hmalib0% | 1% | 8% | 12% | 78%
pdq/php0% | 0% | 22% | 21% | 55%
tmk/cpp0% | 0% | 19% | 15% | 64%
python-threatexchange/threatexchange0% | 0% | 7% | 7% | 85%
hasher-matcher-actioner/webapp0% | 0% | 5% | 25% | 68%
pdq/cpp0% | 0% | 11% | 13% | 75%
api-reference-examples/go0% | 0% | 51% | 0% | 48%
pdq/python0% | 0% | 7% | 20% | 71%
api-reference-examples/php0% | 0% | 9% | 21% | 68%
api-reference-examples/js0% | 0% | 0% | 0% | 100%
python-threatexchange/benchmarks0% | 0% | 0% | 0% | 100%
hasher-matcher-actioner/scripts0% | 0% | 0% | 0% | 100%
hasher-matcher-actioner/hmalib_extensions0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 50 most complex units
Unit# linesMcCabe index# params
190 49 3
81 40 4
54 40 3
96 39 3
101 39 3
51 34 2
89 32 3
116 32 2
134 31 1
150 28 2
82 26 3
87 26 1
45 25 2
69 25 1
50 24 2
77 24 3
82 24 3
97 24 5
85 24 5
111 24 3
49 23 2
88 23 5
96 23 1
95 23 2
95 23 2
66 23 2
68 22 0
79 22 5
86 21 1
91 20 6
58 19 3
57 19 18
41 19 1
94 19 17
95 19 17
70 18 5
71 17 2
51 17 4
65 17 1
45 17 3
51 16 2
34 15 2
51 15 2
63 15 5
60 15 5
140 15 9
52 14 3
29 14 1
39 14 2
50 14 2