microsoft / CCF
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,439 units with 37,266 lines of code in units (62.0% of code).
    • 2 very complex units (1,836 lines of code)
    • 2 complex units (317 lines of code)
    • 53 medium complex units (5,532 lines of code)
    • 151 simple units (6,633 lines of code)
    • 2,231 very simple units (22,948 lines of code)
4% | <1% | 14% | 17% | 61%
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
h6% | 1% | 12% | 17% | 62%
cpp0% | 0% | 22% | 19% | 57%
py0% | 0% | 20% | 20% | 58%
ts0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
c0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src5% | <1% | 15% | 17% | 61%
python0% | 0% | 21% | 21% | 57%
doc0% | 0% | 25% | 0% | 74%
include0% | 0% | 0% | 28% | 71%
scripts0% | 0% | 0% | 66% | 33%
js0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
void init_handlers()
in src/node/rpc/node_frontend.h
1064 114 0
void init_handlers()
in src/node/rpc/member_frontend.h
772 69 0
void commit()
in src/consensus/aft/raft.h
150 38 1
std::optional populate_receipts()
in src/node/historical_queries.h
167 27 1
bool run_main()
in src/enclave/enclave.h
204 25 0
Results produce_results()
in src/perf_client/timing.h
191 24 3
void do_execute_request()
in src/apps/js_v8/js_v8_base.cpp
199 21 3
void recv_append_entries()
in src/consensus/aft/raft.h
173 21 4
void rollback()
in src/consensus/aft/raft.h
87 21 1
inline std::string schema_name()
in src/ds/json_schema.h
94 21 0
135 21 5
void initiate_join()
in src/node/node_state.h
188 21 0
89 20 1
CommitResult commit()
in src/kv/store.h
118 20 3
void recover_public_ledger_entry()
in src/node/node_state.h
97 20 1
static void js_wrap_key()
in src/apps/js_v8/tmpl/ccf_global.cpp
142 19 1
171 19 15
def add_transaction()
in python/ccf/ledger.py
58 18 2
void do_execute_request()
in src/apps/js_generic/js_generic_base.cpp
185 18 5
static void get_state_range()
in src/apps/js_v8/tmpl/historical.cpp
80 17 1