golang / vscode-go
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 674 units with 14,705 lines of code in units (81.0% of code).
    • 11 very long units (2,043 lines of code)
    • 49 long units (3,235 lines of code)
    • 183 medium size units (5,754 lines of code)
    • 145 small units (2,104 lines of code)
    • 286 very small units (1,569 lines of code)
13% | 21% | 39% | 14% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts14% | 22% | 38% | 13% | 11%
go11% | 20% | 43% | 20% | 4%
js0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src10% | 24% | 41% | 13% | 10%
src/debugAdapter27% | 16% | 36% | 13% | 5%
src/goTest26% | 16% | 18% | 16% | 21%
tools24% | 10% | 50% | 14% | 0%
tools/relnotes0% | 53% | 20% | 19% | 6%
tools/goplssetting0% | 23% | 42% | 26% | 8%
src/utils0% | 14% | 31% | 26% | 27%
tools/installtools0% | 0% | 53% | 35% | 11%
media0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
495 56 1
constructor()
in src/debugAdapter/goDebug.ts
265 74 2
private runGoCode()
in src/goSuggest.ts
197 52 10
public async resolveDebugConfiguration()
in src/goDebugConfiguration.ts
190 69 3
protected scopesRequest()
in src/debugAdapter/goDebug.ts
150 22 2
static setup()
in src/goTest/explore.ts
146 29 1
async run()
in src/goTest/run.ts
139 38 3
126 20 3
func main()
in tools/generate.go
124 22 0
private async setBreakPoints()
in src/debugAdapter/goDebug.ts
107 16 2
104 17 4
func main()
in tools/relnotes/relnotes.go
100 26 0
98 5 1
94 24 4
function spawnDlvDapServerProcess()
in src/goDebugFactory.ts
94 23 4
92 28 8
public provideImplementation()
in src/goImplementations.ts
85 16 3
85 19 3
83 7 1
public provideTypeDefinition()
in src/goTypeDefinition.ts
83 20 3