dart-lang / samples
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 49 units with 469 lines of code in units (42.7% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 4 medium size units (133 lines of code)
    • 13 small units (163 lines of code)
    • 32 very small units (173 lines of code)
0% | 0% | 28% | 34% | 36%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart0% | 0% | 33% | 32% | 33%
c0% | 0% | 0% | 47% | 52%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
server/google_apis0% | 0% | 83% | 16% | 0%
ffi/structs0% | 0% | 59% | 15% | 25%
ffi/primitives0% | 0% | 50% | 32% | 16%
command_line/lib0% | 0% | 0% | 51% | 48%
null_safety/calculate_lix0% | 0% | 0% | 100% | 0%
ffi/system-command0% | 0% | 0% | 45% | 54%
ffi/hello_world0% | 0% | 0% | 65% | 34%
extension_methods/example0% | 0% | 0% | 0% | 100%
extension_methods/lib0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void main()
in ffi/structs/structs.dart
42 3 0
void main()
in ffi/primitives/primitives.dart
37 3 0
Future currentProjectId()
in server/google_apis/lib/helpers.dart
31 4 0
Future terminateRequestFuture()
in server/google_apis/lib/helpers.dart
23 4 0
void main()
in ffi/hello_world/hello.dart
17 3 0
String describe()
in null_safety/calculate_lix/lib/lix.dart
15 7 0
bool isTooOld()
in command_line/lib/src/util.dart
13 4 2
String format()
in command_line/lib/src/formatter.dart
13 2 1
int shellExecute()
in ffi/system-command/windows.dart
13 1 2
Stream _fetchUserStatsImpl()
in command_line/lib/github_activity.dart
12 5 0
int messageBox()
in ffi/system-command/win32ui.dart
12 1 2
int main()
in ffi/primitives/primitives_library/primitives.c
12 1 0
int multi_sum()
in ffi/primitives/primitives_library/primitives.c
12 2 2
Future serveHandler()
in server/google_apis/lib/helpers.dart
11 1 1
int _calculate()
in null_safety/calculate_lix/lib/lix.dart
11 3 0
String format()
in command_line/lib/src/formatter.dart
11 2 1
int main()
in ffi/structs/structs_library/structs.c
11 1 0
Stream getActivityStrings()
in command_line/lib/github_activity.dart
10 3 0
String? getUrl()
in command_line/lib/src/util.dart
10 3 1
String? getTitle()
in command_line/lib/src/util.dart
10 3 1