microsoft / AttackSurfaceAnalyzer
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 578 units with 9,165 lines of code in units (56.2% of code).
    • 4 very long units (736 lines of code)
    • 25 long units (1,799 lines of code)
    • 105 medium size units (3,254 lines of code)
    • 118 small units (1,746 lines of code)
    • 326 very small units (1,630 lines of code)
8% | 19% | 35% | 19% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs8% | 19% | 35% | 19% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Lib/Collectors12% | 25% | 40% | 12% | 9%
Cli26% | 41% | 18% | 5% | 8%
Lib/Utils0% | 15% | 49% | 21% | 13%
Benchmarks0% | 5% | 24% | 39% | 31%
Lib/Objects0% | 6% | 33% | 14% | 44%
Lib/Properties0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public FileSystemObject FilePathToFileSystemObject()
in Lib/Collectors/FileSystemCollector.cs
237 58 1
public static ASA_ERROR RunCollectCommand()
in Cli/AttackSurfaceAnalyzerClient.cs
194 58 1
public void Compare()
in Lib/Collectors/BaseCompare.cs
183 50 4
public static SarifLog GenerateSarifLog()
in Cli/AttackSurfaceAnalyzerClient.cs
122 15 2
public static bool Setup()
in Benchmarks/SystemSqliteDatabaseManager.cs
99 14 2
private static ASA_ERROR RunMonitorCommand()
in Cli/AttackSurfaceAnalyzerClient.cs
94 13 1
public static IEnumerable ParseComObjects()
in Lib/Collectors/ComObjectCollector.cs
94 28 3
public override ASA_ERROR Setup()
in Lib/Utils/SqliteDatabaseManager.cs
85 8 0
83 14 0
private static List GetNetStatPorts()
in Lib/Utils/Win32OpenPortListenerHelper.cs
83 17 0
private static ASA_ERROR RunConfigCommand()
in Cli/AttackSurfaceAnalyzerClient.cs
82 14 1
internal void ExecuteOsX()
in Lib/Collectors/UserAccountCollector.cs
77 18 1
public static string GetFilePermissions()
in Lib/Collectors/FileSystemUtils.cs
75 27 1
public void ExecuteMacOs()
in Lib/Collectors/EventLogCollector.cs
73 13 1
internal void ExecuteLinux()
in Lib/Collectors/UserAccountCollector.cs
73 15 1
public void ExecuteWindows()
in Lib/Collectors/EventLogCollector.cs
71 16 1
internal void ExecuteMacOs()
in Lib/Collectors/FirewallCollector.cs
70 7 1
private static ASA_ERROR ExportCompareResults()
in Cli/AttackSurfaceAnalyzerClient.cs
69 6 5
private static void Main()
in Cli/AttackSurfaceAnalyzerClient.cs
68 1 1
private static ASA_ERROR RunExportCollectCommand()
in Cli/AttackSurfaceAnalyzerClient.cs
68 12 1