awslabs / aws-go-multi-module-repository-tools
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 224 units with 3,534 lines of code in units (82.2% of code).
    • 2 very long units (239 lines of code)
    • 8 long units (514 lines of code)
    • 40 medium size units (1,259 lines of code)
    • 55 small units (817 lines of code)
    • 119 very small units (705 lines of code)
6% | 14% | 35% | 23% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go6% | 14% | 35% | 23% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
cmd/eachmodule56% | 0% | 16% | 14% | 11%
release22% | 0% | 60% | 10% | 5%
cmd/changelog0% | 27% | 45% | 21% | 5%
cmd/annotatestablegen0% | 78% | 0% | 11% | 9%
internal/semver0% | 19% | 35% | 22% | 21%
cmd/updatemodulemeta0% | 44% | 26% | 20% | 9%
cmd/makerelative0% | 34% | 19% | 25% | 19%
cmd/moduleversion0% | 74% | 0% | 16% | 9%
gomod0% | 13% | 25% | 11% | 49%
cmd/calculaterelease0% | 81% | 0% | 0% | 18%
cmd/generatechangelog0% | 0% | 69% | 20% | 10%
cmd/gomodgen0% | 0% | 81% | 10% | 7%
changelog0% | 0% | 21% | 47% | 30%
cmd/tagrelease0% | 0% | 73% | 0% | 26%
cmd/editmoduledependency0% | 0% | 50% | 22% | 26%
ROOT0% | 0% | 18% | 53% | 27%
cmd/updaterequires0% | 0% | 37% | 27% | 34%
git0% | 0% | 0% | 71% | 28%
manifest0% | 0% | 0% | 58% | 41%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func run()
in cmd/eachmodule/main.go
129 31 0
func Calculate()
in release/calculate.go
110 30 4
func runCreateCommand()
in cmd/changelog/create.go
89 27 2
func main()
in cmd/annotatestablegen/main.go
75 24 0
func Parse()
in internal/semver/semver.go
63 17 1
func main()
in cmd/updatemodulemeta/main.go
61 18 0
func addRelativeReplaces()
in cmd/makerelative/main.go
59 13 3
func main()
in cmd/moduleversion/main.go
57 14 0
func UpdateRequires()
in gomod/version.go
56 16 4
func main()
in cmd/calculaterelease/main.go
54 13 0
func BuildReleaseManifest()
in release/release.go
50 10 5
func()
in gomod/module_tree.go
47 11 1
func main()
in cmd/generatechangelog/main.go
47 14 0
func prepareTargetDirectory()
in cmd/gomodgen/main.go
45 15 2
func comparePrerelease()
in internal/semver/semver.go
44 14 2
func generateSummary()
in cmd/generatechangelog/summary.go
41 9 2
func interactiveEdit()
in cmd/changelog/create.go
40 10 2
func FilterModuleFiles()
in gomod/diff.go
39 9 2
func NextReleaseID()
in release/release.go
39 10 1
func CommandWorker()
in cmd/eachmodule/cmd.go
37 11 4