microsoft / pxt-blockly
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 3,562 units with 42,476 lines of code in units (40.3% of code).
    • 11 very long units (1,350 lines of code)
    • 74 long units (4,921 lines of code)
    • 458 medium size units (13,356 lines of code)
    • 780 small units (11,334 lines of code)
    • 2,239 very small units (11,515 lines of code)
3% | 11% | 31% | 26% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js3% | 11% | 31% | 26% | 27%
py0% | 30% | 23% | 14% | 32%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
core2% | 7% | 30% | 29% | 30%
generators9% | 27% | 33% | 15% | 13%
blocks0% | 8% | 45% | 28% | 18%
scripts0% | 23% | 22% | 20% | 34%
closure0% | 0% | 0% | 73% | 26%
appengine0% | 0% | 0% | 30% | 70%
externs0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
Blockly.Dart[''] = function()
in generators/dart/math.js
159 10 1
Blockly.Lua[''] = function()
in generators/lua/math.js
137 10 1
Blockly.Dart[''] = function()
in generators/dart/lists.js
136 36 1
130 2 3
Blockly.JavaScript[''] = function()
in generators/javascript/math.js
123 17 1
121 26 1
113 58 2
Blockly.PHP[''] = function()
in generators/php/lists.js
113 37 1
109 29 2
107 39 2
102 1 3
100 53 2
Blockly.blockRendering.ConstantProvider = function()
in core/renderers/common/constants.js
97 2 0
init: function()
in blocks/lists.js
92 21 0
Blockly.PHP[''] = function()
in generators/php/math.js
92 17 1
Blockly.zelos.ConstantProvider = function()
in core/renderers/zelos/constants.js
90 1 0
Blockly.PHP[''] = function()
in generators/php/lists.js
89 19 1
Blockly.Python[''] = function()
in generators/python/math.js
87 10 1
86 23 2
Blockly.WorkspaceCommentSvg.prototype.render = function()
in core/workspace_comment_render_svg.js
85 14 0