microsoft / cppwinrt
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 1,271 units with 13,814 lines of code in units (53.4% of code).
    • 7 very long units (1,178 lines of code)
    • 31 long units (2,120 lines of code)
    • 106 medium size units (3,355 lines of code)
    • 200 small units (2,896 lines of code)
    • 927 very small units (4,265 lines of code)
8% | 15% | 24% | 20% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h7% | 15% | 21% | 21% | 33%
cpp12% | 15% | 43% | 14% | 13%
cs0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cppwinrt11% | 26% | 32% | 20% | 9%
strings5% | 4% | 9% | 23% | 57%
natvis8% | 16% | 48% | 16% | 10%
vsix/ProjectTemplates0% | 0% | 49% | 13% | 36%
vsix/ItemTemplates0% | 0% | 0% | 0% | 100%
vsix/Dev160% | 0% | 0% | 0% | 100%
vsix/Dev170% | 0% | 0% | 0% | 100%
scratch0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
struct __declspec()
in strings/base_implements.h
360 47 1
static void write_consume_extensions()
in cppwinrt/code_writers.h
172 21 2
static void write_component_g_cpp()
in cppwinrt/component_writers.h
156 23 2
static void write_component_g_h()
in cppwinrt/component_writers.h
140 12 2
static void write_delegate_definition()
in cppwinrt/code_writers.h
124 16 2
void GetInterfaceData()
in natvis/object_visualizer.cpp
116 24 4
static int run()
in cppwinrt/main.cpp
110 29 2
static bool write_structs()
in cppwinrt/code_writers.h
100 20 2
99 21 4
95 7 4
inline int32_t make_marshaler()
in strings/base_marshaler.h
94 11 2
static void write_abi_args()
in cppwinrt/code_writers.h
82 20 2
82 20 2
void write()
in cppwinrt/type_writers.h
80 33 1
auto files()
in cppwinrt/cmd_reader.h
78 18 2
static void write_produce_args()
in cppwinrt/code_writers.h
74 10 2
void write()
in cppwinrt/type_writers.h
74 11 1
static HRESULT EvaluatePropertyExpression()
in natvis/object_visualizer.cpp
70 6 5
69 13 2
static void parse_command_line()
in cppwinrt/cmd_reader.h
66 19 3