facebookresearch / connect-caption-and-trace
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 905 units with 14,288 lines of code in units (90.7% of code).
    • 7 very long units (900 lines of code)
    • 54 long units (3,832 lines of code)
    • 124 medium size units (4,130 lines of code)
    • 165 small units (2,605 lines of code)
    • 555 very small units (2,821 lines of code)
6% | 26% | 28% | 18% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 26% | 28% | 18% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
captioning/models4% | 20% | 27% | 23% | 23%
captioning/utils10% | 46% | 28% | 4% | 10%
tools98% | 0% | 0% | 0% | 1%
captioning/data0% | 33% | 33% | 15% | 17%
captioning/modules0% | 69% | 10% | 10% | 10%
scripts0% | 0% | 76% | 7% | 16%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in tools/train.py
200 76 1
def eval_split()
in captioning/utils/eval_utils_for_coco_caption.py
135 2 5
def eval_split()
in captioning/utils/eval_utils_joint.py
129 2 5
def beam_search()
in captioning/models/CaptionModel_orig.py
116 43 5
def beam_search()
in captioning/models/CaptionModel.py
116 43 5
def old_beam_search()
in captioning/models/CaptionModel_orig.py
102 20 5
def old_beam_search()
in captioning/models/CaptionModel.py
102 20 5
def eval_split()
in captioning/utils/eval_utils_show_control_tell.py
98 2 5
def collate_func()
in captioning/data/dataloader_show_control_tell.py
95 32 3
def _sample()
in captioning/models/AttModel_standard_enco_deco_both.py
94 33 9
def _sample()
in captioning/models/AttModel_both.py
93 33 10
def _sample()
in captioning/models/AttModel_for_coco_caption_baseline.py
92 34 10
def _sample()
in captioning/models/AttModel_for_coco_caption_task.py
88 33 10
def _sample()
in captioning/models/AttModel_both_backup_2020_11_11.py
87 31 10
def _sample()
in captioning/models/AttModel_both_backup_2020_11_07.py
87 31 9
def forward()
in captioning/modules/loss_wrapper_joint.py
83 16 13
def eval_split()
in captioning/utils/eval_utils.py
79 2 4
def eval_split()
in captioning/utils/eval_utils_caption_generation.py
79 2 4
def eval_split()
in captioning/utils/eval_utils_orig.py
78 2 4
def _sample()
in captioning/models/AttModel.py
77 27 9