microsoft / CCF
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 2,439 units with 37,266 lines of code in units (62.0% of code).
    • 25 very long units (5,361 lines of code)
    • 85 long units (5,846 lines of code)
    • 341 medium size units (10,714 lines of code)
    • 504 small units (7,373 lines of code)
    • 1,484 very small units (7,972 lines of code)
14% | 15% | 28% | 19% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h13% | 15% | 27% | 20% | 22%
cpp20% | 13% | 34% | 17% | 14%
py0% | 22% | 19% | 20% | 37%
js0% | 0% | 0% | 100% | 0%
ts0% | 0% | 0% | 0% | 100%
c0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src15% | 15% | 28% | 19% | 20%
python0% | 27% | 11% | 18% | 41%
include0% | 13% | 47% | 18% | 20%
doc0% | 0% | 53% | 29% | 17%
scripts0% | 0% | 42% | 24% | 33%
js0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest 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
JSValue create_ccf_obj()
in src/js/wrap.cpp
259 11 11
bool run_main()
in src/enclave/enclave.h
204 25 0
void do_execute_request()
in src/apps/js_v8/js_v8_base.cpp
199 21 3
196 17 4
Results produce_results()
in src/perf_client/timing.h
191 24 3
void initiate_join()
in src/node/node_state.h
188 21 0
void do_execute_request()
in src/apps/js_generic/js_generic_base.cpp
185 18 5
void CommonEndpointRegistry::init_handlers()
in src/endpoints/common_endpoint_registry.cpp
177 12 0
void recv_append_entries()
in src/consensus/aft/raft.h
173 21 4
171 19 15
std::optional populate_receipts()
in src/node/historical_queries.h
167 27 1
void commit()
in src/consensus/aft/raft.h
150 38 1
static void js_wrap_key()
in src/apps/js_v8/tmpl/ccf_global.cpp
142 19 1
135 21 5
122 15 4
CommitResult commit()
in src/kv/store.h
118 20 3
112 15 5
auto add_node()
in src/node/rpc/node_frontend.h
111 12 6