facebookresearch / suncet
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 139 units with 2,004 lines of code in units (53.3% of code).
    • 4 very long units (821 lines of code)
    • 0 long units (0 lines of code)
    • 9 medium size units (242 lines of code)
    • 31 small units (448 lines of code)
    • 95 very small units (493 lines of code)
40% | 0% | 12% | 22% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py40% | 0% | 12% | 22% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src44% | 0% | 7% | 23% | 24%
ROOT0% | 0% | 68% | 7% | 23%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in src/paws_train.py
251 33 1
def main()
in src/suncet_train.py
231 33 1
def main()
in src/fine_tune.py
180 23 1
def main()
in src/snn_fine_tune.py
159 12 1
def _make_layer()
in src/resnet.py
38 5 6
32 9 5
def init_pipe()
in snn_eval.py
27 2 1
def launch()
in main_distributed.py
25 4 0
def step()
in src/sgd.py
25 8 1
def init_transform()
in src/data_manager.py
25 7 6
def step()
in src/lars.py
24 10 1
def init_distributed()
in src/utils.py
24 7 3
def __call__()
in main_distributed.py
22 6 1
20 7 1
def init_model()
in src/snn_fine_tune.py
19 1 0
def forward()
in src/resnet.py
19 6 3
def forward()
in src/wide_resnet.py
19 6 3
def init_data()
in src/data_manager.py
18 1 9
def __getitem__()
in src/data_manager.py
18 8 2
def _init_imgnt_data()
in src/data_manager.py
17 1 8