dart-lang / pub-dev
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 1,273 units with 19,796 lines of code in units (52.4% of code).
    • 10 very long units (1,409 lines of code)
    • 39 long units (2,583 lines of code)
    • 232 medium size units (6,824 lines of code)
    • 353 small units (5,212 lines of code)
    • 639 very small units (3,768 lines of code)
7% | 13% | 34% | 26% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart7% | 13% | 34% | 26% | 18%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
app/lib7% | 13% | 34% | 25% | 19%
pkg/pub_package_reader25% | 0% | 48% | 17% | 8%
pkg/pub_integration9% | 10% | 27% | 26% | 25%
pkg/web_app0% | 13% | 29% | 40% | 16%
pkg/code_coverage0% | 78% | 12% | 6% | 1%
pkg/pub_validations0% | 67% | 27% | 0% | 4%
pkg/pub_dartdoc0% | 35% | 41% | 7% | 14%
pkg/fake_gcloud0% | 0% | 36% | 26% | 36%
tool0% | 0% | 68% | 17% | 13%
pkg/indexed_blob0% | 0% | 39% | 47% | 12%
pkg/api_builder0% | 0% | 43% | 46% | 10%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
Future process()
in app/lib/dartdoc/dartdoc_runner.dart
195 26 1
Stream _checkPackage()
in app/lib/shared/integrity.dart
188 65 1
Future startIsolates()
in app/lib/service/entrypoint/_isolate.dart
172 15 2
Future summarizePackageArchive()
in pkg/pub_package_reader/lib/pub_package_reader.dart
162 22 5
Future verify()
in pkg/pub_integration/lib/script/dev_version.dart
125 2 1
Future search()
in app/lib/search/mem_index.dart
121 31 1
Future _performTarballUpload()
in app/lib/package/backend.dart
121 18 3
Future updateReportOnCard()
in app/lib/scorecard/backend.dart
120 19 5
_TextResults? _searchText()
in app/lib/search/mem_index.dart
104 30 4
String renderPkgVersionsPage()
in app/lib/frontend/templates/package_versions.dart
101 14 4
Future run()
in app/lib/fake/server/fake_server_entrypoint.dart
98 11 0
Future documentationHandler()
in app/lib/frontend/handlers/documentation.dart
84 22 1
void validateHtml()
in pkg/pub_validations/lib/html/html_validation.dart
83 23 1
Future _lookupOrCreateUserByOauthUserId()
in app/lib/account/backend.dart
80 13 1
List _calculateSearchTabs()
in app/lib/frontend/templates/listing.dart
77 3 1
Future withPage()
in pkg/pub_integration/lib/src/headless_env.dart
76 16 2
Future analyze()
in app/lib/fake/backend/fake_pana_runner.dart
74 26 4
Future createPublisher()
in app/lib/publisher/backend.dart
74 8 2
void updateDartdocStatus()
in pkg/web_app/lib/src/dartdoc_status.dart
73 16 0
Future loadDocument()
in app/lib/search/backend.dart
73 9 1