facebookresearch / GDT
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 266 units with 3,785 lines of code in units (66.5% of code).
    • 6 very long units (955 lines of code)
    • 9 long units (575 lines of code)
    • 18 medium size units (520 lines of code)
    • 56 small units (817 lines of code)
    • 177 very small units (918 lines of code)
25% | 15% | 13% | 21% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py25% | 15% | 13% | 21% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT50% | 10% | 9% | 6% | 21%
datasets0% | 27% | 18% | 34% | 18%
src0% | 7% | 15% | 38% | 39%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in eval_video.py
223 30 2
def main()
in main_gdt.py
181 34 1
def parse_args()
in eval_video.py
167 3 0
def parse_args()
in main_gdt.py
153 3 0
def main()
in main_stica.py
130 22 0
def train()
in main_stica.py
101 12 6
def parse_arguments()
in main_stica.py
94 3 0
def __getitem__()
in datasets/AVideoDataset.py
81 20 2
def _construct_loader()
in datasets/AVideoDataset.py
79 17 1
def log_scalars()
in main_stica.py
56 5 10
def interpolate_bilinear()
in datasets/sparse_image_warp_pytorch.py
54 6 4
def _construct_loader()
in datasets/GDTPretrainDataset.py
53 9 1
def __getitem__()
in datasets/GDTPretrainDataset.py
53 8 2
def log_every()
in src/logger.py
53 8 4
def evaluate()
in eval_video.py
52 8 5
def __getitem__()
in datasets/HT100MDataset.py
50 18 2
def __init__()
in src/resnet.py
42 13 9
def _get_video_ffmpeg()
in datasets/HT100MDataset.py
40 6 4
def forward()
in src/transformer.py
31 7 6
def forward()
in model.py
30 11 4