facebookresearch / dynabench
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,391 units with 22,342 lines of code in units (47.9% of code).
    • 25 very long units (4,958 lines of code)
    • 46 long units (3,024 lines of code)
    • 207 medium size units (6,185 lines of code)
    • 298 small units (4,160 lines of code)
    • 815 very small units (4,015 lines of code)
22% | 13% | 27% | 18% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js44% | 8% | 22% | 13% | 10%
py8% | 16% | 30% | 21% | 22%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
frontends/web44% | 8% | 22% | 13% | 10%
api/controllers19% | 23% | 30% | 18% | 8%
api/migrations86% | 0% | 0% | 0% | 13%
api/models15% | 11% | 14% | 18% | 39%
legacy/torchserve0% | 18% | 50% | 23% | 7%
builder/utils0% | 52% | 26% | 12% | 8%
api0% | 6% | 25% | 25% | 42%
evaluation/utils0% | 20% | 32% | 26% | 20%
evaluation/metrics0% | 33% | 21% | 7% | 38%
evaluation/datasets0% | 16% | 11% | 41% | 29%
evaluation/scripts0% | 16% | 44% | 13% | 25%
api/common0% | 16% | 21% | 42% | 20%
api/cron0% | 23% | 62% | 10% | 3%
annotators0% | 0% | 66% | 30% | 3%
api/tools0% | 0% | 69% | 15% | 15%
evaluation0% | 0% | 100% | 0% | 0%
ROOT0% | 0% | 50% | 34% | 15%
legacy/modelservers0% | 0% | 30% | 47% | 22%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
render()
in frontends/web/src/common/Annotation/ResponseInfo.js
400 31 0
render()
in frontends/web/src/containers/ModelPage.js
347 39 0
render()
in frontends/web/src/containers/App.js
287 7 0
These Terms of Use()
in frontends/web/src/containers/TermsPage.js
271 23 1
agree to()
in frontends/web/src/containers/TermsPage.js
265 23 1
Excluding any User Content and User Models()
in frontends/web/src/containers/TermsPage.js
249 20 1
that you may Submit()
in frontends/web/src/containers/TermsPage.js
248 20 1
interactions you may have with our AI systems()
in frontends/web/src/containers/TermsPage.js
233 20 2
render()
in frontends/web/src/containers/UserPage.js
231 11 0
We reserve the right()
in frontends/web/src/containers/TermsPage.js
221 18 1
def handleAsync()
in api/models/badge.py
221 67 1
that you not provide any sensitive personal information()
in frontends/web/src/containers/DataPolicyPage.js
218 13 6
To the extent that you submit User Content()
in frontends/web/src/containers/TermsPage.js
208 17 1
handleResponse()
in frontends/web/src/common/Annotation/CreateInterface.js
174 35 1
def apply_step()
in api/migrations/20210127_01_sHlix-add-round-user-example-info-table.py
168 30 1
services without our permission()
in frontends/web/src/containers/TermsPage.js
141 13 3
def apply_step()
in api/migrations/20210105_populate-total-verified-not-correct-fooled-column.py
135 33 1
def apply_step()
in api/migrations/20201116_populate-total-verified-not-fooled-column.py
131 30 1
render()
in frontends/web/src/containers/TaskOwnerPage.js
130 21 0
def validate_example()
in api/controllers/validations.py
127 43 2