facebookresearch / xcit
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 131 units with 2,235 lines of code in units (51.1% of code).
    • 2 very long units (331 lines of code)
    • 6 long units (443 lines of code)
    • 17 medium size units (576 lines of code)
    • 29 small units (458 lines of code)
    • 77 very small units (427 lines of code)
14% | 19% | 25% | 20% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py14% | 19% | 25% | 20% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT28% | 0% | 29% | 14% | 27%
detection/tools0% | 100% | 0% | 0% | 0%
semantic_segmentation/tools0% | 60% | 39% | 0% | 0%
detection/backbone0% | 0% | 26% | 52% | 20%
semantic_segmentation/backbone0% | 0% | 26% | 52% | 20%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in main.py
204 52 1
127 1 0
def main()
in detection/tools/test.py
96 39 0
def parse_args()
in detection/tools/test.py
79 5 0
def main()
in detection/tools/train.py
72 19 0
def main()
in semantic_segmentation/tools/train.py
71 19 0
def main()
in semantic_segmentation/tools/test.py
64 21 0
def parse_args()
in detection/tools/train.py
61 5 0
def parse_args()
in semantic_segmentation/tools/test.py
48 2 0
def __init__()
in detection/backbone/xcit.py
46 6 23
def __init__()
in semantic_segmentation/backbone/xcit.py
46 6 23
def log_every()
in utils.py
45 7 4
def parse_args()
in semantic_segmentation/tools/train.py
41 2 0
37 8 12
def build_transform()
in datasets.py
36 5 2
def __init__()
in xcit.py
32 6 20
def main()
in run_with_submitit.py
31 4 0
def __init__()
in datasets.py
31 4 8
def build_dataset()
in datasets.py
29 11 2
def __init__()
in xcit.py
28 3 5