facebookresearch / Detectron
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 531 units with 7,786 lines of code in units (51.1% of code).
    • 3 very long units (383 lines of code)
    • 21 long units (1,467 lines of code)
    • 82 medium size units (2,589 lines of code)
    • 129 small units (1,873 lines of code)
    • 296 very small units (1,474 lines of code)
4% | 18% | 33% | 24% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py4% | 19% | 32% | 24% | 19%
pyx0% | 0% | 92% | 0% | 7%
cc0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
detectron/modeling13% | 14% | 30% | 15% | 25%
detectron/utils6% | 7% | 33% | 25% | 27%
tools0% | 29% | 43% | 19% | 7%
detectron/roi_data0% | 38% | 24% | 27% | 9%
detectron/datasets0% | 23% | 29% | 33% | 12%
detectron/core0% | 18% | 38% | 24% | 18%
detectron/ops0% | 0% | 25% | 66% | 7%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def add_fpn_retinanet_outputs()
in detectron/modeling/retinanet_heads.py
160 24 4
def vis_one_image()
in detectron/utils/vis.py
117 31 14
def add_fpn()
in detectron/modeling/FPN.py
106 13 2
def _get_rpn_blobs()
in detectron/roi_data/rpn.py
99 13 5
def add_fpn_rpn_outputs()
in detectron/modeling/FPN.py
96 12 4
def colormap()
in detectron/utils/colormap.py
88 2 1
def convert_cityscapes_instance_only()
in tools/convert_cityscapes_to_coco.py
87 14 2
def convert_net()
in tools/convert_pkl_to_pb.py
86 11 3
def voc_eval()
in detectron/datasets/voc_eval.py
84 25 7
def _get_retinanet_blobs()
in detectron/roi_data/retinanet.py
79 1 6
def _add_gt_annotations()
in detectron/datasets/json_dataset.py
74 20 2
def parse_args()
in tools/convert_pkl_to_pb.py
72 4 0
def im_detect_bbox_aug()
in detectron/core/test.py
72 16 3
def add_rfcn_outputs()
in detectron/modeling/rfcn_heads.py
65 4 5
def parse_args()
in tools/infer_simple.py
64 2 0
def add_retinanet_blobs()
in detectron/roi_data/retinanet.py
62 28 5
def check_expected_results()
in detectron/datasets/task_evaluation.py
59 9 3
57 19 3
def add_rpn_blobs()
in detectron/roi_data/rpn.py
56 18 3
def im_detect_keypoints_aug()
in detectron/core/test.py
55 12 3