aws / amazon-ec2-metadata-mock
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 92 units with 986 lines of code in units (43.2% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (51 lines of code)
    • 14 medium size units (372 lines of code)
    • 18 small units (289 lines of code)
    • 59 very small units (274 lines of code)
0% | 5% | 37% | 29% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 5% | 37% | 29% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/mock/handlers0% | 56% | 0% | 43% | 0%
pkg/config0% | 0% | 33% | 31% | 35%
pkg/mock/spot0% | 0% | 62% | 22% | 14%
pkg/mock/imdsv20% | 0% | 78% | 21% | 0%
pkg/mock/events0% | 0% | 58% | 29% | 12%
pkg/cmd/root0% | 0% | 35% | 11% | 52%
pkg/cmd/events0% | 0% | 41% | 26% | 32%
pkg/cmd/cmdutil0% | 0% | 37% | 37% | 24%
pkg/mock/static0% | 0% | 56% | 43% | 0%
pkg/mock/dynamic0% | 0% | 55% | 45% | 0%
pkg/cmd/spot0% | 0% | 36% | 26% | 36%
pkg/server0% | 0% | 0% | 30% | 69%
cmd0% | 0% | 0% | 0% | 100%
pkg/mock/root0% | 0% | 0% | 0% | 100%
pkg/error0% | 0% | 0% | 0% | 100%
pkg/config/defaults0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func CatchAllHandler()
in pkg/mock/handlers/handlers.go
51 11 2
func Handler()
in pkg/mock/events/events.go
34 7 2
func NewCmd()
in pkg/cmd/root/root.go
33 2 0
func LoadConfigForRoot()
in pkg/config/config.go
30 6 2
func handleSpotITN()
in pkg/mock/spot/spot.go
30 7 2
func GenerateToken()
in pkg/mock/imdsv2/tokengenerator.go
28 4 2
func ValidateLocalConfig()
in pkg/cmd/events/events.go
28 6 0
func ValidateToken()
in pkg/mock/imdsv2/tokenvalidator.go
27 4 1
func getHandlerPairs()
in pkg/cmd/cmdutil/cmdutil.go
26 4 2
func handleRebalance()
in pkg/mock/spot/spot.go
25 5 2
func RegisterHandlers()
in pkg/mock/static/static.go
23 6 1
func SetMetadataDefaults()
in pkg/config/metadata.go
22 5 1
func SetDynamicDefaults()
in pkg/config/dynamic.go
22 5 1
func RegisterHandlers()
in pkg/mock/dynamic/dynamic.go
22 6 1
func ValidateLocalConfig()
in pkg/cmd/spot/spot.go
22 6 0
20 5 0
func Handler()
in pkg/mock/spot/spot.go
20 6 2
func formatRoutes()
in pkg/mock/handlers/handlers.go
20 5 0
func WriteConfigToFile()
in pkg/config/config.go
19 4 0
func ListRoutesHandler()
in pkg/mock/handlers/handlers.go
19 6 2