facebookresearch / swav
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 56 units with 1,220 lines of code in units (72.9% of code).
    • 4 very long units (433 lines of code)
    • 2 long units (124 lines of code)
    • 9 medium size units (314 lines of code)
    • 11 small units (170 lines of code)
    • 30 very small units (179 lines of code)
35% | 10% | 25% | 13% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py35% | 10% | 25% | 13% | 14%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT49% | 14% | 25% | 4% | 5%
src0% | 0% | 25% | 38% | 36%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in eval_semisup.py
117 15 0
def main()
in eval_linear.py
110 12 0
def main()
in main_swav.py
103 17 0
def main()
in main_deepclusterv2.py
103 11 0
def train()
in main_swav.py
69 16 6
def train()
in main_deepclusterv2.py
55 11 7
def cluster_memory()
in main_deepclusterv2.py
47 7 5
def train()
in eval_linear.py
46 4 5
def train()
in eval_semisup.py
45 4 4
def _make_layer()
in src/resnet50.py
38 5 6
def validate_network()
in eval_linear.py
33 4 3
def validate_network()
in eval_semisup.py
32 4 2
29 15 3
def init_memory()
in main_deepclusterv2.py
22 4 2
def create_logger()
in src/logger.py
22 7 2
def __init__()
in eval_linear.py
20 6 5
19 3 1
def initialize_exp()
in src/utils.py
19 6 3
16 3 1
def forward()
in src/resnet50.py
16 5 2