microsoft / Oryx
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 747 units with 11,615 lines of code in units (43.4% of code).
    • 7 very long units (942 lines of code)
    • 29 long units (2,101 lines of code)
    • 109 medium size units (3,339 lines of code)
    • 195 small units (2,873 lines of code)
    • 407 very small units (2,360 lines of code)
8% | 18% | 28% | 24% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs6% | 17% | 29% | 25% | 21%
go19% | 23% | 24% | 18% | 14%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/startupscriptgenerator19% | 23% | 24% | 18% | 14%
src/BuildScriptGenerator6% | 11% | 30% | 29% | 21%
src/BuildScriptGeneratorCli8% | 26% | 33% | 20% | 11%
src/Detector8% | 26% | 24% | 23% | 16%
build/tools0% | 20% | 21% | 19% | 38%
src/BuildScriptGenerator.Common0% | 11% | 24% | 17% | 46%
src/Oryx.Common0% | 0% | 34% | 21% | 43%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public BuildScriptSnippet GenerateBashBuildScriptSnippet()
in src/BuildScriptGenerator/Node/NodePlatform.cs
220 40 2
internal override int Execute()
in src/BuildScriptGeneratorCli/Commands/BuildCommand.cs
146 11 2
public PlatformDetectorResult Detect()
in src/Detector/Python/PythonDetector.cs
133 26 1
func main()
in src/startupscriptgenerator/src/dotnetcore/main.go
116 13 0
func()
in src/startupscriptgenerator/src/node/scriptgenerator.go
114 20 1
public BuildScriptSnippet GenerateBashBuildScriptSnippet()
in src/BuildScriptGenerator/Python/PythonPlatform.cs
108 17 2
func main()
in src/startupscriptgenerator/src/python/main.go
105 4 0
public string GetRelativePathToProjectFile()
in src/Detector/DotNetCore/ProjectFileProviders/ProbeAndFindProjectFileProvider.cs
100 18 1
func main()
in src/startupscriptgenerator/src/node/main.go
98 3 0
internal override int Execute()
in src/BuildScriptGeneratorCli/Commands/PrepareEnvironmentCommand.cs
97 8 2
public PlatformDetectorResult Detect()
in src/Detector/Node/NodeDetector.cs
93 17 1
public void GenerateBashScript()
in src/BuildScriptGenerator/DefaultBuildScriptGenerator.cs
90 12 3
public string GetSatisfyingSdkVersion()
in src/BuildScriptGenerator/DotNetCore/GlobalJsonSdkResolver.cs
89 17 2
protected string GetInstallerScriptSnippet()
in src/BuildScriptGenerator/PlatformInstallerBase.cs
88 2 3
private string BuildScriptFromSnippets()
in src/BuildScriptGenerator/DefaultBuildScriptGenerator.cs
86 5 7
public int OnExecute()
in build/tools/AutoUpdater/GitHubRunnersCachedImagesCheckCommand.cs
85 6 2
public PlatformDetectorResult Detect()
in src/Detector/Ruby/RubyDetector.cs
84 13 1
func main()
in src/startupscriptgenerator/src/ruby/main.go
84 3 0
func()
in src/startupscriptgenerator/src/dotnetcore/scriptgenerator.go
83 12 1
func()
in src/startupscriptgenerator/src/python/scriptgenerator.go
81 10 1