facebookresearch / corefnmn
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 237 units with 4,451 lines of code in units (80.6% of code).
    • 7 very long units (856 lines of code)
    • 14 long units (956 lines of code)
    • 47 medium size units (1,362 lines of code)
    • 44 small units (653 lines of code)
    • 125 very small units (624 lines of code)
19% | 21% | 30% | 14% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py19% | 21% | 30% | 14% | 14%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
util25% | 12% | 21% | 18% | 21%
models_vd16% | 28% | 31% | 12% | 11%
loader_vd49% | 17% | 23% | 5% | 3%
models_mnist9% | 17% | 36% | 18% | 17%
vis54% | 0% | 13% | 18% | 13%
exp_vd0% | 100% | 0% | 0% | 0%
exp_mnist0% | 100% | 0% | 0% | 0%
loader_mnist0% | 0% | 86% | 9% | 4%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def load_one_batch()
in loader_vd/data_reader.py
152 56 2
def build_imdb()
in util/build_imdb.py
126 36 1
def _build_decoder()
in models_vd/generator_attnet.py
123 12 5
def _build_decoder()
in models_mnist/generator_attnet.py
123 12 5
def main()
in vis/visualize_dialogs.py
115 37 1
def extract_corefs()
in util/extract_coreference_supervision.py
111 11 2
def __init__()
in models_vd/generator.py
106 27 4
def _assemble_program()
in models_mnist/assembler.py
90 5 7
def read_command_line()
in exp_vd/options.py
85 5 0
def __init__()
in models_vd/decoder.py
80 18 4
def _assemble_program()
in models_vd/assembler.py
77 5 7
def read_command_line()
in exp_mnist/options.py
77 5 0
def _build_memory_encoder()
in models_vd/generator_attnet.py
70 11 4
def _build_memory_encoder()
in models_mnist/generator_attnet.py
70 11 4
def extract_set()
in util/convert_nmn_layouts.py
67 30 1
def _build_loom_ops()
in models_vd/executor.py
63 3 1
def _build_loom_ops()
in models_mnist/executor.py
59 3 1
def _build_placeholders()
in models_vd/model.py
58 9 2
def __init__()
in loader_vd/data_reader.py
55 24 3
def segregrate_outputs()
in models_vd/executor.py
53 17 2