facebookresearch / Mephisto
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,070 units with 10,752 lines of code in units (43.1% of code).
    • 10 very long units (1,655 lines of code)
    • 22 long units (1,478 lines of code)
    • 67 medium size units (2,119 lines of code)
    • 135 small units (1,971 lines of code)
    • 836 very small units (3,529 lines of code)
15% | 13% | 19% | 18% | 32%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js37% | 26% | 10% | 13% | 12%
py8% | 8% | 21% | 20% | 41%
tsx0% | 32% | 58% | 0% | 9%
ts0% | 0% | 51% | 13% | 34%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages/annotation-toolkit61% | 25% | 6% | 3% | 2%
packages/annotated45% | 40% | 7% | 1% | 4%
mephisto/abstractions4% | 7% | 18% | 24% | 45%
mephisto/scripts54% | 36% | 0% | 6% | 2%
mephisto/operations13% | 4% | 29% | 26% | 26%
mephisto/client9% | 9% | 47% | 14% | 18%
mephisto/tools0% | 35% | 0% | 31% | 32%
mephisto/data_model0% | 5% | 18% | 14% | 60%
packages/mephisto-review-hook0% | 54% | 41% | 0% | 3%
packages/mephisto-task0% | 21% | 12% | 34% | 31%
hydra_plugins0% | 0% | 0% | 0% | 100%
packages/cra-template-mephisto-review0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export default function MovableRect()
in packages/annotation-toolkit/src/layers/MovableRect.js
288 50 8
export default function MovableRect()
in packages/annotated/bbox/src/MovableRect.js
286 48 8
export default function VideoPlayer()
in packages/annotation-toolkit/src/layers/VideoPlayer.js
177 20 8
function ContentPanel()
in packages/annotated/shell/src/panels/ContentPanel.js
147 25 1
function ContentPanel()
in packages/annotation-toolkit/src/panels/ContentPanel.js
147 25 1
def _register_agent()
in mephisto/operations/supervisor.py
146 18 3
def main()
in mephisto/scripts/mturk/launch_makeup_hits.py
146 18 0
def create_mephisto_vpc()
in mephisto/abstractions/architects/ec2/ec2_helpers.py
110 1 1
def create_security_group()
in mephisto/abstractions/architects/ec2/ec2_helpers.py
105 2 3
def get_help_arguments()
in mephisto/client/cli.py
103 23 1
function RequesterForm()
in mephisto/client/full/webapp/src/widgets/components/RequesterForm.tsx
100 3 3
def main()
in mephisto/scripts/mturk/identify_broken_units.py
97 31 0
function Layer()
in packages/annotated/shell/src/Layer.js
92 10 13
function Layer()
in packages/annotation-toolkit/src/layers/Layer.js
92 10 13
def __setup_heroku_server()
in mephisto/abstractions/architects/heroku_architect.py
86 10 1
def build_and_return_custom_bundle()
in mephisto/abstractions/blueprints/parlai_chat/parlai_chat_task_builder.py
83 28 2
function formatMessage()
in packages/annotated/dev-scripts/utils/formatWebpackMessages.js
73 14 1
def get_status()
in mephisto/abstractions/providers/mturk/mturk_unit.py
70 7 1
def augment_config_from_db()
in mephisto/tools/scripts.py
60 10 2
render()
in packages/annotated/bbox/src/RRRR/Rect/index.js
60 2 0