dart-lang / dart-pad
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 484 units with 4,799 lines of code in units (32.2% of code).
    • 1 very long units (122 lines of code)
    • 7 long units (425 lines of code)
    • 45 medium size units (1,359 lines of code)
    • 86 small units (1,232 lines of code)
    • 345 very small units (1,661 lines of code)
2% | 8% | 28% | 25% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart2% | 9% | 28% | 24% | 34%
js0% | 0% | 0% | 69% | 30%
py0% | 0% | 0% | 47% | 52%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib6% | 11% | 36% | 18% | 27%
lib/services0% | 41% | 24% | 8% | 25%
lib/editing0% | 32% | 23% | 6% | 36%
lib/sharing0% | 11% | 40% | 25% | 21%
lib/src0% | 0% | 25% | 31% | 42%
lib/elements0% | 0% | 15% | 32% | 51%
web/example0% | 0% | 19% | 32% | 48%
lib/inject0% | 0% | 18% | 47% | 34%
lib/core0% | 0% | 18% | 37% | 43%
lib/workshops0% | 0% | 0% | 75% | 24%
web/scripts0% | 0% | 0% | 48% | 51%
lib/util0% | 0% | 0% | 51% | 48%
web0% | 0% | 0% | 60% | 39%
tool0% | 0% | 0% | 46% | 53%
lib/modules0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
Future complete()
in lib/completion.dart
122 21 3
String _decorateJavaScript()
in lib/services/execution_iframe.dart
74 9 4
Future _loadAndShowGist()
in lib/embed.dart
72 15 1
Future _completionHelper()
in lib/editing/editor_codemirror.dart
62 12 3
Future loadGistFromRepo()
in lib/sharing/gists.dart
60 11 5
void _initPlayground()
in lib/playground.dart
54 2 0
void _lookupParameterInfo()
in lib/parameter_popup.dart
52 9 0
void _showParameterPopup()
in lib/parameter_popup.dart
51 5 2
Element _createIssueElement()
in lib/elements/analysis_results_controller.dart
50 5 1
void _init()
in lib/embed.dart
49 9 0
factory VersionResponse()
in lib/src/protos/dart_services.pb.dart
49 12 12
void showPackageVersionsDialog()
in lib/sharing/editor_ui.dart
46 3 0
Future handleRun()
in lib/sharing/editor_ui.dart
46 4 0
MDCMenu _buildSamplesMenu()
in lib/playground.dart
45 2 0
Element _buildChannelsMenu()
in lib/playground.dart
45 3 1
factory AnalysisIssue()
in lib/src/protos/dart_services.pb.dart
45 11 11
void generateDoc()
in lib/documentation.dart
44 12 1
void _changeLayout()
in lib/playground.dart
44 5 1
Future performAnalysis()
in lib/sharing/editor_ui.dart
42 7 0
void _showGist()
in lib/playground.dart
39 9 1