dart-lang / pub
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 574 units with 10,335 lines of code in units (65.2% of code).
    • 6 very long units (744 lines of code)
    • 36 long units (2,455 lines of code)
    • 107 medium size units (3,270 lines of code)
    • 147 small units (2,217 lines of code)
    • 278 very small units (1,649 lines of code)
7% | 23% | 31% | 21% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart7% | 23% | 31% | 21% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib/src/command18% | 28% | 34% | 13% | 4%
lib/src4% | 25% | 29% | 19% | 19%
lib/src/solver8% | 28% | 30% | 21% | 11%
tool0% | 67% | 32% | 0% | 0%
lib/src/validator0% | 7% | 50% | 33% | 8%
lib/src/source0% | 6% | 29% | 34% | 30%
lib/src/authentication0% | 23% | 9% | 48% | 18%
tool/test-bin0% | 0% | 0% | 0% | 100%
lib/src/sdk0% | 0% | 0% | 0% | 100%
lib0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
Future _outputHuman()
in lib/src/command/outdated.dart
151 43 13
138 39 2
Future runProtected()
in lib/src/command/outdated.dart
131 16 0
void _visit()
in lib/src/solver/failure.dart
116 23 3
_ParseResult _parsePackage()
in lib/src/command/add.dart
107 19 2
Future getExecutableForCommand()
in lib/src/executable.dart
101 15 6
Future nullSafetyComplianceOfPackages()
in lib/src/null_safety_analysis.dart
100 18 2
String toString()
in lib/src/solver/incompatibility.dart
100 24 1
String? _createBinStub()
in lib/src/global_packages.dart
100 17 6
Future runProtected()
in lib/src/command/deps.dart
96 22 0
Future _reportPackage()
in lib/src/solver/report.dart
89 32 3
Future _runUpgradeNullSafety()
in lib/src/command/upgrade.dart
89 11 0
Future runProtected()
in lib/src/command/add.dart
80 16 0
Future acquireDependencies()
in lib/src/entrypoint.dart
78 17 8
Future runProtected()
in lib/src/command/global_activate.dart
77 17 0
Future _runUpgradeMajorVersions()
in lib/src/command/upgrade.dart
75 9 0
void _checkPackageConfigUpToDate()
in lib/src/entrypoint.dart
71 12 0
Map _parseDependencies()
in lib/src/pubspec.dart
71 17 2
Future main()
in tool/extract_all_pub_dev.dart
70 9 0
void _updateBinStubs()
in lib/src/global_packages.dart
69 20 5