microsoft / tolerant-php-parser
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 367 units with 4,638 lines of code in units (56.7% of code).
    • 1 very long units (140 lines of code)
    • 8 long units (566 lines of code)
    • 44 medium size units (1,235 lines of code)
    • 99 small units (1,456 lines of code)
    • 215 very small units (1,241 lines of code)
3% | 12% | 26% | 31% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
php3% | 12% | 26% | 31% | 26%
ts0% | 0% | 60% | 39% | 0%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
experiments22% | 0% | 25% | 17% | 34%
src0% | 15% | 25% | 33% | 24%
php-langspec/tools/xreference0% | 0% | 64% | 24% | 10%
src/Node0% | 0% | 20% | 32% | 47%
src/Node/Statement0% | 0% | 49% | 27% | 23%
syntax-visualizer/server/src0% | 0% | 100% | 0% | 0%
syntax-visualizer/client/src0% | 0% | 0% | 100% | 0%
tools0% | 0% | 0% | 100% | 0%
src/Node/Expression0% | 0% | 0% | 0% | 100%
syntax-visualizer/client0% | 0% | 0% | 0% | 100%
syntax-visualizer/example0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private function scan()
in experiments/Lexer.php
140 64 0
99 25 4
87 38 0
78 32 2
71 59 0
69 41 1
56 26 1
55 15 0
51 25 2
49 24 3
42 13 3
public function getResolvedName()
in src/Node/QualifiedName.php
41 20 1
39 11 3
37 19 1
37 16 1
37 31 1
35 8 0
35 9 3
public function getDiagnosticForNode()
in src/Node/Statement/BreakOrContinueStatement.php
32 9 0
32 9 1