facebookresearch / mmf
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 2,471 units with 24,818 lines of code in units (45.7% of code).
    • 9 very long units (1,688 lines of code)
    • 27 long units (1,821 lines of code)
    • 236 medium size units (6,952 lines of code)
    • 423 small units (6,111 lines of code)
    • 1,776 very small units (8,246 lines of code)
6% | 7% | 28% | 24% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 7% | 27% | 24% | 33%
js0% | 0% | 57% | 31% | 10%
c0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
mmf/projects57% | 22% | 4% | 9% | 6%
projects/krisp68% | 19% | 2% | 3% | 6%
tools/sweeps71% | 0% | 6% | 15% | 6%
tools/scripts6% | 14% | 31% | 24% | 22%
mmf/models0% | 8% | 33% | 22% | 35%
mmf/utils0% | 6% | 31% | 27% | 34%
mmf/datasets0% | 2% | 30% | 28% | 39%
mmf/trainers0% | 7% | 28% | 25% | 37%
projects/m4c0% | 50% | 16% | 27% | 6%
mmf_cli0% | 20% | 60% | 10% | 8%
mmf/modules0% | 0% | 27% | 32% | 39%
mmf/common0% | 0% | 8% | 19% | 72%
website/src0% | 0% | 64% | 35% | 0%
projects/m4c_captioner0% | 0% | 0% | 100% | 0%
ROOT0% | 0% | 0% | 18% | 81%
website0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def forward()
in projects/krisp/graphnetwork_module.py
288 74 2
def forward()
in mmf/projects/krisp/graphnetwork_module.py
288 74 2
def launch_train()
in tools/sweeps/lib/slurm.py
212 6 2
def get_args()
in tools/sweeps/lib/__init__.py
171 3 1
def from_pretrained()
in tools/scripts/features/frcnn/modeling_frcnn.py
159 30 4
def __init__()
in projects/krisp/graphnetwork_module.py
149 35 3
def __init__()
in mmf/projects/krisp/graphnetwork_module.py
149 35 3
def get_answer_info()
in projects/krisp/graphnetwork_module.py
136 15 2
def get_answer_info()
in mmf/projects/krisp/graphnetwork_module.py
136 15 2
def prepare_embeddings()
in projects/krisp/graphnetwork_module.py
92 28 3
def prepare_embeddings()
in mmf/projects/krisp/graphnetwork_module.py
92 28 3
def forward()
in mmf/models/mmf_bert.py
88 18 2
def _process_features()
in tools/scripts/features/frcnn/extract_features_frcnn.py
87 6 3
def build()
in mmf/models/unit/unit.py
86 13 1
def get_parser()
in tools/scripts/features/frcnn/extract_features_frcnn.py
84 2 1
def download()
in mmf/utils/download.py
79 27 5
def run_training_epoch()
in mmf/trainers/core/training_loop.py
76 26 1
def save()
in mmf/utils/checkpoint.py
73 18 4
def main()
in projects/m4c/scripts/extract_ocr_frcn_feature.py
71 5 0
def main()
in mmf/projects/m4c/scripts/extract_ocr_frcn_feature.py
71 5 0